Page 2 of 3

Re: Notification escalations

Posted: Wed Mar 15, 2017 1:43 pm
by tmcdonald
Can you verify the version of Core you are using?

Re: Notification escalations

Posted: Wed Mar 15, 2017 1:56 pm
by Nagios_Admin_M
I am using version 3.5.1.

Re: Notification escalations

Posted: Thu Mar 16, 2017 12:39 pm
by tmcdonald
Out of curiosity, if you reverse the order of the definitions, does the behavior change?

Re: Notification escalations

Posted: Thu Mar 16, 2017 1:28 pm
by Nagios_Admin_M
No, it doesn't. The notifications are sen't to both of the address'es e-mails although the interval is used from one of them.
Example: Notifications are sent to both of the e-mails with 20 minutes delay or 1152( I used 5 minutes period this time ).
It behaves like it override the interval period into one of the escalations.

Re: Notification escalations

Posted: Thu Mar 16, 2017 1:36 pm
by tmcdonald
Ohhhh, that's different. I thought you were saying that only the first definition was taking place at all.

I'll ask the developer what the intended behavior is, but I could see the argument either way for using the lower interval vs the last one defined.

Will update when I hear back.

Re: Notification escalations

Posted: Thu Mar 16, 2017 4:35 pm
by cdienger
The behavior you are seeing is as designed. See https://assets.nagios.com/downloads/nag ... tions.html for more information. Specifically:

In any case where there are multiple valid escalation definitions for a particular notification, Nagios will choose the smallest notification interval. Take the following example:

define serviceescalation {
host_name webserver
service_description HTTP
first_notification 3
last_notification 5
notification_interval 45
contact_groups nt-admins,managers
}

define serviceescalation {
host_name webserver
service_description HTTP
first_notification 4
last_notification 0
notification_interval 60
contact_groups nt-admins,managers,everyone
}

We see that the two escalation definitions overlap on the 4th and 5th notifications. For these notifications, Nagios will use a notification interval of 45 minutes, since it is the smallest interval present in any valid escalation definitions for those notifications.

Re: Notification escalations

Posted: Fri Mar 17, 2017 3:55 am
by Nagios_Admin_M
I understand, now.

Is there a way to get send out two notification escalations for one service/host notification at different time intervals? Both of them needs to be send starting from first notification till forever.

Thank you.

Re: Notification escalations

Posted: Fri Mar 17, 2017 2:19 pm
by cdienger
You may want to investigate setting up event handlers to trigger a custom script you create to do what you need. https://assets.nagios.com/downloads/nag ... dlers.html has some details regarding event handlers and an example script to get you started.

Re: Notification escalations

Posted: Wed Mar 22, 2017 10:39 am
by Nagios_Admin_M
Yes, I view the manual. Although as my knowledge is leading me to it is not possible to use send-notification-host/serviece-by-email twice for the same alert. Or is it leading me wrong.

define service{
command_name email
command_line /usr/bin/myscript
}


###myscript
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n $NOTIFICATIONCOMMENT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

Re: Notification escalations

Posted: Wed Mar 22, 2017 1:13 pm
by cdienger
The event handler would be called once after the service is in a HARD state, therefore you would need to create a script to periodically check services and email at the desired frequency and terminate the script once the problem was resolved.

event_handler would be used in the service definition instead of command_name and command_line.