currently there are essentially two methods, that I know of, to retrieve active alarms:
querying the db, i.e.: " SELECT * FROM alarm_events" with a fixed polling time
looping with a python script, i.e. " system.alarm.queryStatus()" and then sleeping in between or similar.
both of these methods are looping/polling methods and they are quite expensive (we use the db polling at the moment with a 5 minutes delay and we are quickly reaching millions of queries per hour on each of our Aurora RDS cluster).
Is there some event based / subscription method for fetching alarms which is less taxing and more realtime? something like system.alarm.subscribe(tag_path) which fires when an alarm is ever raised or reenters?
You can call scripts from alarm pipelines and cache the information.
We are experimenting with something similar however the solution is not very robust:
- we need to define a pipeline for all alarms
- we need to define the pipeline for the raise, acked and entered states
- we must store a last-executed time in a memory tag to avoid consecutive alarms from trashing the server.
- we must create a polling gateway event to execute all this logic every 1 minute.
I hoped perspective / ignition offered something more realtime and event oriented.
Not from inside the Ignition runtime, but it’s possible using the module SDK to register a listener that receives active, clear, and acknowledge notification for events as they occur.
Thank you for the response. I’ll take a look at the SDK.