Dynamic Notification Profile - Alarm Pipeline Notification Block

I was wondering if anyone has been able to customize the notification block component.
I am wanting to script which notification profile is used based on some alarm event associated data.

For Example, I have 4 Regions, each region has its own notification profile in order to prevent backlogged alarms.
All my alarms go to the same pipelines. Is there a way to script which notification profile an alarm event utilizes rather than the drop down?

Check out the “Contacts” section in the documentation for the Notification Block component. You are likely looking for either an expression or calculated roster type, depending on whether you want to define your rosters on the gateway beforehand (expression) or if you want to dynamically create a list of users with their contact info within this notification block (calculated).

I am currently using calculated rosters.

There are 10+ remote gateways, all alarms configured on those gateways are being pointed to a central alarm pipeline gateway. I am using associated data to evaluate where the alarms are coming from, then i am able to can call upon the correct roster info for that remote gateway.
I am wanting to add a layer to make the notification profile dynamic.
I did not see anything in the calculated roster about how i could script in the 4/5 notification profiles.

Are you talking about something similar to the example of the “Switch” block?

If i use a switch block, i would have to replicate all my pipelines for each notification profile.
I am wanting to be able to script the notification profile
So on the notification block ,there is the notification tab. That is what im wanting to script rather than the drop down list

In this case, I think it might be simplest to establish your 4 or 5 groups of alarm recipients as individual on call rosters, then use the switch block to handle which notification block (one for each of your 4 or 5 groups) the alarm is sent to, like @bpreston is suggesting. It might not be as programmatically “smart” as using one notification block in your pipeline, but it will likely be much easier for someone else who did not set it up to maintain in the future.

If i use switch blocks, this logic will have to be repeated for each notification profile, which would be a lot more work to maintain. Each region group contains approx 3/4 remote gateway which need independent rosters. Also the pipeline work area does not like getting stretched passed a normal screen resolution, so it would not be possible for me to replicate this logic 5 times in a pipeline.
Which is why i want to script the notification profile in for less upkeep.

The Switch block I think would be the easiest method. If your determined to use calculated you can and you can look up people assigned to different roster through scripting using system.alarm.getRosters() then use system.user.getUser() to get their contact info. You would have to use something from the event property to determine where the alarm is being called from. You should be able to get the source from there and use that to determine the roster.

With what you just replied though, is there any reason you couldn’t link some of those together, I can’t see enough detail to know but I would wonder if there is a way to combine some of those blocks to make it easier to maintain.

1 Like

Ultimately, you’re going to have to hardcode a list of usernames or something that can be used to identify which users belong to which value of your associated data property (whether that’s a list of strings like this example, defining different on-call rosters, or even assigning certain users different roles to handle this), so it will be hard to make this truly dynamic. Just off the top of my head, you could probably use something like this in a calculated roster though:

usersource = 'default'
userGroup1 = ['joe','bob']
userGroup2 = ['mary','sue']
roster = []
def createRosterUser(source, username):
	contactString = str(system.user.getUser(source, user).getContactInfo())
	sms = contactString.split('sms: ')[-1].split(',')[0].replace(']','')
	return {'username':user,'sms':sms}
if event['associatedData'] is 'typeA':
	for user in userGroup1:
		roster.append(createRosterUser(usersource, user))
elif event['associatedData'] is 'typeB':
	for user in userGroup2:
		roster.append(createRosterUser(usersource, user))
return roster

You’d probably also want to use a catch-all event with an “else” statement at the end of the if, just to make sure no alarms slip through the cracks, but I’ll leave that up to you how you want to handle that.

Each level is calling different users as the alarm escalates

This is just one pipeline for critical alarms ( I have a pipeline with specific escalations for each alarm priority)
I have an initial pipeline that is routing the alarms based on priority, and i have a catch all there.