Influencing notification sequence

To enhance our notification handling all notifications are converted into Jira issues.
After the problem is resolved the Jira issues is transitioned to another state.

To make it even easier I would like to link the Jira issue in the notification E-Mail.

Is there a way to influence the sequence in which notifications are sent?
Like renaming the objects to “001_jira”, “002_mail”, etc?

Currently I handle the Jira issue creation and sending of the e-mail within the same script and every subsequent notification checks for a local file which associates the problem with a jira issue.
If it doesn’t exist the issue and file will be created. If not the jira issue from the file will be linked.
Though I’d really like to decouple these features.

Not really, the order of objects is non-deterministic for this event type. You could add the notification name into the sent notifications, and have a mail proxy in the middle, which ensures the order to events forwarded to Jira then. This “proxy” needs to be built though, I don’t have such at hand. I know such ideas from my previous job where they wanted to rate limit the notifications for their external support teams.

Such proxy logic could also be built into the notification script itself too. I remember a customer project where automated state logic for ticket open, comment and resolve was necessary with HP’s ITSM. Unfortunately that code was not allowed being open-sourced.

Cheers,
Michael

1 Like

The only built in way of achieving this would be by using escalations. But since this would slow down the sending of e-mails this might not be what you want.

2 Likes

Actually that sounds like a great idea. I never considered escalations.
Delaying the E-Mail by a few seconds shouldn’t hurt.
Thank you!

Be aware that this will need to repeat the notification after a few seconds and you will have to make sure that the first command went through before the second one is triggered.

I’d be interested if this works out. Could you show us the configuration if it works?

The second notification will probably just need to handle a missing Jira URL if the first notification fails.
I’ll share the config when it’s stable.

After some tweaking I have a stable configuration now.
What I did was setting up a set of notification variables to separately configure start, end and interval for each notification channel (e-mail, sms, jira):

template Host "00_generic_host" {
	vars.notification_email_begin = 10
	vars.notification_sms_end = 14401
	vars.notification_sms_interval = 3600
	vars.notification_timeperiod = "10x5"
	vars.notification_host_states = [ "Down" ]
	vars.notification_types = [ "Problem", "Recovery" ]
	vars.notification_methods = [ "mail", "jira", "sms" ]
	vars.notifications_enabled = true
}

The E-Mail delay defaults to 10 seconds and the Jira delay to 0 resulting in a 10 second time window for the Jira script to create the issue.
Additionally I’m planning to implement a retry loop in the notification script which would allow to wait additional X seconds if the 10 second delay is not sufficient. Not sure about that yet though.

1 Like