Reading alarm info for many tags at once

I’d really like to get a lot of alarm info at once. So I’ll have a list of a couple hundred tags, and I’m only interested in them if they have at least 1 alarm on them. I know of system.tag.browseConfiguration() and then .getAlarms on one of those results, but that seems to be pretty slow so far. Its a fine last resort but I’m hoping someone knows of a good way to at least see which tags in a list of paths have at least 1 alarm.

Thanks!

Consider using a tag change event script to monitor your tags continually, caching their alarm status in a dictionary held in a python script module. The dictionary can be quickly iterated to pluck out the tag paths that have any alarms, without causing any additional gateway-client traffic.

I should be clearer, I’m not looking for any active alarms, I’m looking for if they have any at all configured on the tag, active or not.

Sorry. I don’t think there’s any alternative to iterating through your tag definitions.

Dang. Actually, I sort of already have what you first suggested, at least as far as a list of tags I keep track of goes. That stuff runs in the background so this added time won’t really affect anything… Should be good.

I wanted to update everyone here - a coworker has found a very simple way of doing this, I didn’t realize this function can work this way -

results = system.alarm.queryStatus(source=["**"]) # Main Folder
for result in results:
    sourcePath =str( result.source)
    sourcePath = (sourcePath.replace('prov:','')).split(':')[2]
    print sourcePath
    tagDefs = system.tag.getAlarmStates(sourcePath)
    for tagDef in tagDefs:
        print tagDef.alarm

I wouldn’t recommend using print here because it’ll take forever, but as far as I can tell its a decent way of just getting everything that has an alarm. Alarms not in use will show up as something like [Cleared, Acknowledged] as its state.

I’d like to revive this a bit - this solution is working mostly except I’m not exactly sure what kinds of alarms system.alarm.queryStatus returns. My initial testing looked like it showed all enabled alarms but not disabled alarms, however I have a couple of examples where the tag diagnostics popup says its enabled, but its not showing up as a result of queryStatus. They’re in UDTs and one example of a binding is “!{[.]Enable/Alarms Disabled}&&{[.]Enable/High Alarm Enabled}”. The relative paths for those two tags and Alarms Disabled is false, High Alarm Enabled is true, and as I said diagnostics says the alarm is enabled but its not showing up in queryStatus. I’ve tried adding all_properties = [(‘enabled’, ‘=’, True)] and the same except using False, but True returns the same results as without and False returns none. I’ve also included includeShelved = True just in case but no luck.

I’m looking for some more insight into this function and why it doesn’t seem to be recognizing this alarm that seems to be enabled.