Has Alarms been added yet?

This thread is the last update I've seen on it.

If you do that you'll have alarms in a logging table in your database. You can display a history of that by querying the table and displaying the results in a data grid control.

I wrote this query to display alarm information from the logging tables logging to a Microsoft SQL Server database (in case it's helpful to you). It just displays the alarm name, start time and end time. You could potentially get incorrect results if you have multiple alarms with the same name.

SELECT
SUBSTRING(AE.source, PATINDEX('%alm:%', AE.source) + 4, LEN(AE.source) - PATINDEX('%alm:%', AE.source)) AS Alarm,
AE.eventtime AS Alarmed,
(
SELECT TOP 1 MAX(AEC.eventtime)
FROM alarm_events AS AEC
WHERE
AEC.eventtype = 1
AND SUBSTRING(AEC.source, PATINDEX('%alm:%', AEC.source) + 4, LEN(AEC.source) - PATINDEX('%alm:%', AEC.source)) = SUBSTRING(AE.source, PATINDEX('%alm:%', AE.source) + 4, LEN(AE.source) - PATINDEX('%alm:%', AE.source))
AND AEC.eventtime > AE.eventtime
) AS Cleared,
(
SELECT TOP 1 MAX(AEA.eventtime)
FROM alarm_events AS AEA
WHERE
AEA.eventtype = 2
AND SUBSTRING(AEA.source, PATINDEX('%alm:%', AEA.source) + 4, LEN(AEA.source) - PATINDEX('%alm:%', AEA.source)) = SUBSTRING(AE.source, PATINDEX('%alm:%', AE.source) + 4, LEN(AE.source) - PATINDEX('%alm:%', AE.source))
AND AEA.eventtime > AE.eventtime
) AS Acknowledged
FROM alarm_events AS AE
INNER JOIN alarm_event_data as ED
ON AE.id = ED.id
WHERE AE.eventtype = 0 AND ED.dtype = 0
ORDER BY AE.eventtime DESC

1 Like