Defined alarms in the system


Is there a way to get the list of all the configured alarms in the system?

The idea is to display in a table the list of defined alarms (with their label) so that users can see all configured alarms.

Thanks in advance for your answers!


Hi @latifa.rhandour, this post has a way for obtaining tags with alarms.

Then you could built your dataset with this for displaying in a table.


Hi @code_skin , thanks for your answer!
I thought about using system.alarm.queryStatus() but I’m not sure i can get all configured alarms with this. I think i can only get activeUnacked, activeAcked, clearUnacked, clearAcked …
So if an alarm never went active it won’t appear in the dataset

1 Like

I use this function often to get all the alarm tags defined in the system.

Try this to see if you can work with it:

  • Create a new window,
  • drag a button and a power table on the window
  • paste the below in the buttons actionPerformed
alarmTags = system.alarm.queryStatus(source=["*"])
event.source.parent.getComponent('Power Table').data = alarmTags.getDataset()

This will return a full list of all tags that have alarms configured regardless of the alarm state.

From the manual:
Queries the current state of alarms.

1 Like

I found that using statusquery didn’t get a full list. I don’t think I ever was able to get a full list…
Or maybe I had to use system.tag.browse for it or the other config one?

Hi Latifa,

I think you can achieve your requirement by combining:

In this example I am writing the results to a Dataset type tag, of course you can get more information / props if you need.

# This function was designed to run from a Gateway Scoped call. Client based calls (such as those triggered by a button press) should search in an asynchronous thread.
# Define the search as a function. This makes recursion easier.
def manualSearch(initPath):
    # If troubleshooting, you could print out the initPath here
    # Create a result set of just tags. This call could be modified to look for a specific sub of tags,
    # such as just UDT instances
    tagSet = system.tag.browseTags(parentPath = initPath, tagPath = '*',                                   
    # Create a result set of just folders. We'll iterate over this set and call browseTags() again for the results.                                             
    folderSet = system.tag.browseTags(parentPath = initPath, tagPath = '*',
                                        tagType = 'Folder',
    # Iterate through our folders...                                  
    for folder in folderSet:
        # If troubleshooting, you also could print out folder.path here.
        # ...And start the process over again until we run out of folders.
    # Return the list of tags.
    return tagSet
# Call this on the manual tag provider. Change the intialPath here if searching through a specific Tag Provider.
myTags = manualSearch("[Sample_Tags]")

for myTag in myTags:
		tagDefs = system.tag.getAlarmStates(str(myTag))
		for tagDef in tagDefs:
			AlmDef= tagDef.alarm
print idx
AlmSet = system.dataset.toDataSet(headers, data)

That worked perfectly! Thanks a lot!