Generate a list of alarms assigned to an alarm Pipeline

Is there a way to generate a list of alarms configured on tags that are assigned to a specific alarm pipeline? I need to display this on a window but I think I'm confusing myself.

Not backwards like that, no. Alarms flow into pipelines, but pipelines have no knowledge of what alarms feed into them. You could 'register' each alarm that flows into a pipeline using a script block, but you'd never know for sure if that was truly every alarm that could.

Hmmm... ok. There's no way to get that information from the tag configurations?

You'd have to go through all tags, then all the alarms, then find the configured pipelines. Doable, but expensive. Kinda similar to the task described here:

Yes, I was playing around with something similar but I will try to refine it a bit with that example and see what I can do. Thanks!

It would be a lot easier if there was a property on the alarm section of a tag named ActivePipeline or something similar. hint hint :wink:
image

There can be multiple event instances for any given alarm, in any number of pipelines simultaneously depending on your setup. A tag/alarm property doesn't make any sense.

I guess so... I get that an alarm instance can be redirected or flow from one pipeline to another, but I'm only interested in the pipeline that the alarm is initially assigned to. I get that it can be dynamic, but so can the display path and any other parameter so I'm not sure why those parameters are any different? Ignorance is bliss I suppose...

For anyone else interested in this I made a gateway timer script that runs once an hour and put the following code in it to dump the results into a dataset memory tag. Then on the Vision window that I need to display the alarms on I just read that tag and search for the alarm pipeline that I'm interested in. The alarm information only updates once an hour but that's fine for what I'm using it for.

# Search through all tags to find any alarm set up on a tag.
# This will make showing which alarms are in each pipeline much easier because it takes a LONG time to do the search.
path = '[default]'

def getAlarmsInTagProvider(tagProvider):
	alarms = []
    
	tagPaths = system.tag.browse(path=tagProvider, filter = {'tagType':'AtomicTag', "recursive":True}).results
    
	for tagPath in tagPaths:
		if 'alarm' in tagPath['attributes']:
			tagConfig = system.tag.getConfiguration(tagPath['fullPath'])
			for alarm in tagConfig[0]['alarms']:
				try:
					activePipe = alarm['activePipeline']
					alarms.append([activePipe, str(tagConfig[0]['path']) + " - " + alarm['name']])
				except:
					pass
	return alarms
	
alarmData = getAlarmsInTagProvider(path)
header = ['Pipeline', 'Alarm']
dataSet = system.dataset.toDataSet(header, alarmData)
tag = ['[default]_Settings/Alarm Pipeline Data']
# Write dataset to tag
system.tag.writeBlocking(tag, [dataSet])
1 Like