Page 1 of 1

Nagios warning and critical notifications interval

Posted: Thu Mar 05, 2015 4:39 am
by cimbi
I'm trying to configure Nagios service notifications this way:

- Send email notification after being for 30 minutes in the warning state
- Send email notification after being for 15 minutes in the critical state

I can't get it working at all. I can' manage the situation when there is a warning for a short time followed by the critical (or vice versa). Nagios seems to combine time spent in these states together, which is not what I want.

Do you have some ideas how to get it working as expected?

Re: Nagios warning and critical notifications interval

Posted: Thu Mar 05, 2015 9:44 pm
by Box293
I believe escalations are required here.

In a service definition, you define a the first_notification_delay to 0.
You don't define any contacts or contact groups.
This will make it send a notification immediately (but it'll go to no-one).

You then create a service escalation.

Code: Select all

define serviceescalation {
	host_name                     		localhost
	service_description           		Current Load
	first_notification            		1
	last_notification             		2
	notification_interval         		30
	escalation_period             		24x7
	escalation_options            		w,
	}
When the service enters a HARD state, this sets the notification_interval to 30 minutes for a WARNING state. This is for notification #1.
It still doesn't send a notification to anyone because there are no contacts or contactgroups.

Now you create another service escalation.

Code: Select all

define serviceescalation {
	host_name                     		localhost
	service_description           		Current Load
	contacts                      		nagiosadmin
	first_notification            		2
	last_notification             		0
	notification_interval         		30
	escalation_period             		24x7
	escalation_options            		w,
	}


This no defines that notifications #2 - 0 (forever) will be sent to the contact nagiosadmin for WARNINGS, 30 minutes apart.

Repeat for CRITICAL:

Code: Select all

define serviceescalation {
	host_name                     		localhost
	service_description           		Current Load
	first_notification            		1
	last_notification             		2
	notification_interval         		15
	escalation_period             		24x7
	escalation_options            		c,
	}	

define serviceescalation {
	host_name                     		localhost
	service_description           		Current Load
	contacts                      		nagiosadmin
	first_notification            		2
	last_notification             		0
	notification_interval         		15
	escalation_period             		24x7
	escalation_options            		c,
	}


The CRITICALs work the same way, just 15 minutes apart.

I hope this makes sense.

Re: Nagios warning and critical notifications interval

Posted: Fri Mar 06, 2015 3:06 am
by cimbi
Many thanks for your tip. Unfortunately it still doesn't work as I would like to. When the service is in state "warning" for e. g. one our and then switches to "critical", the notification for "critical" event comes immediately and not after desired 15 minutes :-(. Or am I doing something wrong?

Re: Nagios warning and critical notifications interval

Posted: Fri Mar 06, 2015 4:14 pm
by scottwilkerson
This granularity is not available currently.

Re: Nagios warning and critical notifications interval

Posted: Fri Mar 06, 2015 7:32 pm
by Box293
Just to expand on what scottwilkerson said.

When Nagios detects a HARD state change from OK to WARNING/CRITICAL/UNKNOWN, this triggers notifications and event handlers. If the service result later changes from WARNING to CRITICAL, Nagios does not detect this as the state is already HARD (non-OK).