I have been asked to create an Alarm-User tool to find what alarms are associated with a user or alternatively what users will recieve alarm notifications.
I really want to do this programmatically in scripting to get current information from project/gateway resources.
I have been able to get the information from the Tag/alarm and get the user/Roster info as follows.
for alarm info:
tagPath = "XXXXXXX"
line,tag = tagPath.split("/") # this generally requires subfolder management left out for example
configs = system.tag.getConfiguration(tagPath, True)
for tagprops in configs:
alarms = tagprops.get("alarms")
for alarm in alarms:
activePipeline = str(alarm.get("activePipeline"))
print "Alarm Name: ", str(alarm.get("name"))
project,pipeline = activePipeline.split("/")
print "project: ",project
print "pipeline: ",pipeline
print "----"
then for the user/roster content
username = "xxxxxxx"
rosters = system.alarm.getRosters()
rosterNames = rosters.keys()
for name in rosterNames:
users = rosters.get(name)
if username in users:
users = rosters.get(name)
print name
I know that the Notification Pipeline and notification block properties are stored somewhere in the project resources but I have not been able to identify where and how to get the roster from the notification block definition.
we do not use dynamic roster in the notification blocks.
I appreciate any advise on how to get this info.
I do not want to depend on any designers having to maintain a seperate list that will inevitably have errors.