Alarm Event getCount()

Trying to use the Alarm Events in some scripts for a client. Can’t seem to find any info on how or where to use them.

Any suggestion?

Thanks

I can’t tell which alarm events you’re talking about… :confused:

Sorry, it was a long day.

I’m trying to count the number of active alarms returned from the system.alarm.queryStatus function. I can display the results from the query in a table, but haven’t been able to figure out how to count them yet.

Hope this helps.

Thanks

If you are simply trying to get the number of alarms on a gateway, you could look at the system tags for alarm counts:

System/Gateway/Alarming/…
Active and Acked
Active and Unacked
Clear and Acked
Clear and Unacked

Adding the first two will give you all the active alarms on the gateway.

I'm thinking the various methods on the AlarmEvent object need to be better documented. I'll make a note of this.

In the mean time, assuming a source/display path filter is easy enough to construct, if you're just looking for a count of active alarms, you could len() on the list returned by queryStatus() :

alarms = system.alarm.queryStatus(state = ["ActiveAcked", "ActiveUnacked"])

print len(alarms)

Thanks for all the help!

I’ve got it working now.