# Reading alarm info for many tags at once

**URL:** <https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991>\
**Category:** Ignition\
**Created:** [May 10, 2018, 3:45pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991 "2018-05-10T15:45:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 10, 2018, 3:45pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991/1 "2018-05-10T15:45:14Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 10, 2018, 3:51pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991/2 "2018-05-10T15:51:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 10, 2018, 3:52pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991/3 "2018-05-10T15:52:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 10, 2018, 3:54pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991/4 "2018-05-10T15:54:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 10, 2018, 4:32pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991/5 "2018-05-10T16:32:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 14, 2018, 5:44pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991/6 "2018-05-14T17:44:59Z")

</div>

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 -

```auto
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.

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [June 6, 2018, 3:34pm UTC](https://forum.inductiveautomation.com/t/reading-alarm-info-for-many-tags-at-once/17991/7 "2018-06-06T15:34:03Z")

</div>

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.
