Alternating Notification Commands

Seth Simmons ssimmons at cymfony.com
Tue Dec 2 20:41:08 CET 2008


You want to configure Nagios to send alerts by email during the day by
sms the rest of the time?
Why don't you just create 2 separate contact definitions, one for email
and one for sms with different time definitions?

Would look something like this:

define contact{
	contact_name			sysadmin-1
	use					generic-contact
	alias					sysadmin workhours
	host_notification_period	workhours
	service_notification_period	workhours
	host_notification_options	d,r
	service_notification_options	w,c,r
	email					sysadmin at mydomain.com
	}

define contact{
	contact_name			sysadmin-2
	use					generic-contact
	alias					sysadmin after work
	host_notification_period	afterwork
	service_notification_period	afterwork
	host_notification_options	d,r
	service_notification_options	w,c,r
	email					2125553000 at txt.att.net
	}

define timeperiod{
	timeperiod_name	workhours
	alias		Normal Work Hours
	monday		08:00-16:59
	tuesday		08:00-16:59
	wednesday		08:00-16:59
	thursday		08:00-16:59
	friday		08:00-16:59
	}

define timeperiod{
	timeperiod_name	afterwork
	alias		Normal Work Hours
	monday		17:00-24:00
	tuesday		17:00-24:00
	wednesday		17:00-24:00
	thursday		17:00-24:00
	friday		17:00-24:00
	saturday		00:00-24:00
	sunday		00:00-24:00
	}

define service{
	use						local-service 
	hostgroup_name				Linux
	service_description			Load Average
	check_command				check_nrpe!check_load
	max_check_attempts			2
	check_interval				10
	retry_interval				5
	check_period				24x7
	notification_interval			60
	first_notification_delay		0
	notification_period			24x7
	contacts
sysadmin-1,sysadmin-2
	notification_options			c,w,r
	}

As far as certain services sms only, use the 24x7 time period, create
contact for the 24x7 time period and configure the service accordingly.


define contact{
	contact_name			sysadmin-3
	use					generic-contact
	alias					sysadmin sms
	host_notification_period	24x7
	service_notification_period	24x7
	host_notification_options	d,r
	service_notification_options	w,c,r
	email					2125553000 at txt.att.net
	}

define service{
	use					local-service         
	hostgroup_name			linux
	service_description		Free Space on /
	check_command			check_nrpe!check_root
	max_check_attempts		2
	check_interval			15
	retry_interval			5
	check_period			24x7
	notification_interval		60
	first_notification_delay	0
	notification_period		24x7
	contacts				sysadmin-3
	notification_options		c,w,r
	}

The way that is configured, any problems with load in your linux
hostgroup will send notification by email during the day and by sms
after hours/weekends.  The second example will send by sms at any time
for any alerts with free space.


-----Original Message-----
From: Steven Kreuzer [mailto:skreuzer at exit2shell.com] 
Sent: Tuesday, December 2, 2008 2:08 PM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Alternating Notification Commands

Greetings-

In addition to the two included commands for sending notifications, I  
defined two new ones called notify-host-by-sms and notify-service-by- 
sms.

What I would like to do is configure nagios to have it send alerts by  
email during normal business hours and send alerts by sms the rest
of the time. I would also like to configure certain critical services  
to only alert by sms regardless of the time of day.

 From what I can tell, there does not appear to be a straight forward  
way to do this because "host_notification_commands" and  
"service_notification_commands" are defined under "contact". It looks  
like I would have to
create two contacts for each person, one with their email and one with  
their pager.

Is there any way around this?

Thanks

Steven Kreuzer
http://www.exit2shell.com/~skreuzer


------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list