Page 1 of 1

Different

Posted: Mon May 04, 2020 9:19 am
by danjoh
Is it possible to have a different "host_notification_commands/service_notification_commands" for escalations?
Example:
We have two users (say "dan" & "ken"), both are setup with host- and service-notification commands (notify-host-by-email/notify-service-by-email).
"dan" is primary contact for "host1" (this host has no escalation configuration).
"ken" is the primary contact for "host2" and "dan" receives escalations from this host.
What I want to do is to use different host- and service-notification commands when escalating host2 to "dan" compared with the normal notifications for host1.

Any suggestions?

Re: Different

Posted: Mon May 04, 2020 4:02 pm
by benjaminsmith
Hi @danjoh,

That's a good question. This isn't an out-of-the-box feature in Nagios Core, but you might be able to create a wrapper script for the notification command on this host that will check if the notification is escalated or check to see who is being notified and call the different notification command.

There is a Standard Macro available in Nagios Core that will indicate if it's escalated or not and the recipient of the notification.
$NOTIFICATIONISESCALATED$ An integer indicating whether this was sent to normal contacts for the host or service or if it was escalated. 0 = Normal (non-escalated) notification , 1 = Escalated notification.
$NOTIFICATIONRECIPIENTS$ A comma-separated list of the short names of all contacts that are being notified about the host or service.
I haven't tested this, but that might be an option.

Re: Different

Posted: Tue May 05, 2020 12:26 am
by danjoh
Thanks for the feedback.

I will look into using $NOTIFICATIONISESCALATED$ in my notification script (I already have a script for sending notifications in HTML format). This should not be that hard to extend.

By the way, sorry for the short title - pressed "Submit" a bit to fast. :oops:

Re: Different

Posted: Tue May 05, 2020 4:35 pm
by cdienger
Thanks for the update!