Alarm and Event value query

I want to run a query from outside Ignition on the MySQL database to get the active alarms and the event value that trigger the event.
I am able to get the Active alarms and the Timestamp by this query.
‘SELECT * FROM alarm_events WHERE eventtype=2 OR eventtype=3 GROUP BY source’
How can I modify the query to include the event value?

SELECT * FROM alarm_events  
inner join alarm_event_data on alarm_events.id = alarm_event_data.id
WHERE eventtype=2 OR eventtype=3
GROUP BY source

I got bit in the rear end by this, so I thought I'd clarify something:

If you want the active alarms, the eventtype is 0. NOT 2 and 3.
You need to check that page, which describes the "alarm_event" table:
https://docs.inductiveautomation.com/display/DOC81/Alarm+Journal#AlarmJournal-TableDefinitions

not this one, which describes the parameters for system.alarm.queryJournal:
https://docs.inductiveautomation.com/display/DOC81/system.alarm.queryJournal#system.alarm.queryJournal-StateValues

The states and types are NOT the same thing.

1 Like