Exporting Alarm Status Table to CSV

Hi all!

Our client is requiring to export alarm logs with:

  • time range filter
  • display path filter
  • Showing event value
  • name
  • active time
  • clear time
  • priority
    Is there a way to export alarm status table with these filters applied and these information shown? I have come across system.alarm.queryJournal. However, the info it contains are limited to eventId, source, Displaypath, eventTime, Eventstate. priority and isSystemevent only. I hope someone can advice me on the workaround or script I could use to get this working. Thank you so much in advance.

It would be best to display the alarms in the table. Then the user can already preview the data.

Once you have it in the table, it’s quite simple to export it to CSV with the system.dataset.exportCSV function

Hi @Sanderd17!

Thank you for your response. I tried using systems.alarm.query.Journal to display it first in a table and to do the extract. But the information it provides are limited and does not contain all the info I need. So, I was wondering if there’s a way to show them all. Ignition support suggested it’s better to use system.alarm.queryStatus (thanks Ignition support!) I tried it but, I need to display the Name, ack time, clear time, event value columns from the Alarm status table to the table which I will use to export to csv. However, system.alarm.queryStatus only shows source, displaypath, eventtime, state and priority.

Maybe someone can enlighten me on how I can reflect these additional columns from the alarm status table to another table for csv export.

Thanks in advance!

You will need to examine the AlarmEvent objects. Here is a sample of how to use system.alarm.queryStatus to print some alarm information. You can modify this to put the data you need into a dataset.

system.alarm.queryJournal will be similar but each alarm event (active, cleared, acknowledged) will be separate details.

from com.inductiveautomation.ignition.common.config import BasicProperty
eventTime = BasicProperty("eventTime", BasicProperty().getType())
alarms = system.alarm.queryStatus()

for alarm in alarms:
	print "***********************",alarm.getDisplayPath(),"***********************"
	if not(alarm.getPriority() is None): 
		print "priority: " , alarm.getPriority()
	if not(alarm.getActiveData() is None): 
		print "active time: " , alarm.getActiveData().get(eventTime)
	if not(alarm.getClearedData() is None):
		print "clear time: " , alarm.getClearedData().get(eventTime)
	if not(alarm.getAckData() is None):
		print "ack time: " , alarm.getAckData().get(eventTime)
2 Likes

Thank you so much!
Exactly what I was looking for.

I have no idea on how to start the script and how to properly compose script to return the list in system.alarm.queryStatus.
I was able to put the data into a table and export it now to csv.

Thanks again!