# How to Generate a List of all Configured Alarms

**URL:** <https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651>\
**Category:** Ignition\
**Created:** [July 13, 2020, 5:09pm UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651 "2020-07-13T17:09:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaspinall](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jaspinall](https://forum.inductiveautomation.com/u/jaspinall)\
**Post date:** [July 13, 2020, 5:09pm UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/1 "2020-07-13T17:09:33Z")

</div>

Hi There,

How can one go about generating a list of all tags with configured alarms in Ignition Version 8? I did check the forums/previous posts but i cannot find a clear or definite answer on this.

Thank You!

---

<div class="post-metadata">

**Author:** ![jonathan.taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jonathan.taylor/32/4048_2.png) [@jonathan.taylor](https://forum.inductiveautomation.com/u/jonathan.taylor)\
**Post date:** [July 14, 2020, 1:40pm UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/2 "2020-07-14T13:40:46Z")

</div>

You'll get most of the way with:

> alarms = system.alarm.queryStatus(source=["\*"])

You'll then have to do some processing to get the info out of that.

Be careful though - if theres a lot of tags you will probably want to do this in a separate thread!

---

<div class="post-metadata">

**Author:** ![jaspinall](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jaspinall](https://forum.inductiveautomation.com/u/jaspinall)\
**Post date:** [July 14, 2020, 3:20pm UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/3 "2020-07-14T15:20:22Z")

</div>

Thanks for the reply @jonathan.taylor

I did find this method earlier on some older posts, however, after experimenting with it i've noticed that it does not grab all the alarms.

There is another post below that mentions this as well:

> [@Best way to generate an alarm list](http://forum.inductiveautomation.com/t/best-way-to-generate-an-alarm-list/11773/4):
>
> Sorry all… but, I’ve tried to use the queryStatus above to get a list of all alarms, however I only get 27 alarms returned, where there should be hundreds. I ran this in two locations: my local dev environment, no connection to PLCs where I got the 27 alarms; I also ran it on the production gateway where it returned a large number of alarms. I’m now not confident the “full” alarm list that I gave the customer using this function is in fact a full list at all… Why would these results be differen…

Maybe a good feature request.

---

<div class="post-metadata">

**Author:** ![jonathan.taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jonathan.taylor/32/4048_2.png) [@jonathan.taylor](https://forum.inductiveautomation.com/u/jonathan.taylor)\
**Post date:** [July 14, 2020, 3:25pm UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/4 "2020-07-14T15:25:13Z")

</div>

Yes I think the alarms that query gives are alarms that are enabled and have at some point been active; i’d need to do more testing to double check that though

---

<div class="post-metadata">

**Author:** ![jaspinall](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jaspinall](https://forum.inductiveautomation.com/u/jaspinall)\
**Post date:** [July 14, 2020, 3:33pm UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/5 "2020-07-14T15:33:23Z")

</div>

I think you’re right on that with respect to being enabled and at some point having been active.

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [July 14, 2020, 3:50pm UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/6 "2020-07-14T15:50:46Z")

</div>

Here is what we use. Put this in a project script or on a button, and call getAlarms(rootPath). It will return a list. You will want to run this from the gateway, as it is a recursive browse. Invoke with sendRequest or sendRequestAsync.

```auto
def getAlarms(tagPath):	

	from com.inductiveautomation.ignition.common.tags.paths.parser import TagPathParser
	alarms = []
	def iterTagConfig(dictIn, folderIn = ''):
		keys = dictIn.keys()
		#Move tags and alarms to end of list. I do not recall why, but it is really, really important.
		if 'tags' in keys:
			keys.append(keys.pop(keys.index('tags')))
		if 'alarms' in keys:
			keys.append(keys.pop(keys.index('alarms')))
			
		for key in keys:
			#If the value of dictIn[key] is a dict, then it is a folder like structure that has child tags. Iterate through this
			if isinstance(dictIn[key], dict):
				iterTagConfig(dictIn[key])
			elif key == 'tags':
				for tag in dictIn[key]:
					if str(tag["path"]) != "_types_":
						iterTagConfig(tag, folderIn = folderIn + str(dictIn['path']) + '/' if folderIn else str(dictIn['path']))      
			elif key == 'alarms':
				#This is what we are looking for. Each tag in this alarm item is an alarm, so we add them to the list. Use qualified tag paths because they are exact, and I hear they make you look cooler.
				for tag in dictIn[key]:
					tp = TagPathParser.parseSafe(folderIn+"/"+str(dictIn['path']) if folderIn else str(dictIn['path']))
					qp = "prov:%s:/tag:%s:/alm:%s"%(tp.source,tp.toStringPartial(),tag["name"])
					alarms.append([qp])
					iterTagConfig(tag,folderIn = folderIn + str(dictIn['path']))	
	if tagPath:
		folder = tagPath
		#Root level browse
		nodes = system.tag.getConfiguration(folder, True)
	
		for item in nodes:
			iterTagConfig(item)
	
	return alarms	

```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 6, 2021, 1:33am UTC](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/7 "2021-01-06T01:33:53Z")

</div>

> [@Kyle\_Chase](#):
>
> iterTagConfig(tag, folderIn = folderIn + str(dictIn['path']) + '/' if folderIn else str(dictIn['path']))

I think you're missing ` + '/'` in the else condition here

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/3/83e2144c6a250189cf70cb91f871bbb8922910c9.png)

e.g.  
`iterTagConfig(tag, folderIn = folderIn + str(dictIn['path']) + '/' if folderIn else str(dictIn['path']) + '/') `

Also, thanks again for this, saved me some time!!
