multiple timeperiods, same service check

Shirley shirley at origamipartners.com
Thu Mar 25 01:36:54 CET 2004


i'm sure this question has been asked before, but the mail archives are 
down, apologies for the repetition

scenario:

i want to use timeperiods, contactgroups and templates together to have
the notification & check behavior of a particular hosts' service change
according to time.

for example...if i'm watching load on a solaris machine, and i want to get
paged immediately during the day, but less frequently at night - although
it's still a problem i'd like to know about at night, but not if it's only
a minor blip; i'd rather not have to wake up over something like that.  
(and hopefully i'd be monitoring more specific things to otherwise let me
know the health of the box). so i want paging to be immediate during 
certain hours, but more calm during others, with email notification on all 
the time 

so here are sample definitions:

(timeperiods)

define timeperiod {
 timeperiod_name	workhrs
 alias "normal avail" hours 
 monday 8:00-23:00
 tuesday 8:00-23:00
 wednesday 8:00-23:00
 thursday 8:00-23:00
 friday 8:00-23:00
}

define timeperiod {
 timeperiod_name        afterhrs
 alias we should be asleep
 monday 23:00-08:00
 tuesday 23:00-08:00
 wednesday 23:00-08:00
 thursday 23:00-08:00
 friday 23:00-08:00
}

(service template)

define service {
 name	service_workhrs
 service_description  	service template workhrs
 check_period workhrs
 notification_period workhrs
 max_check_attempts 3
 normal_check_interval 5
 retry_check_interval 1
 notification interval 30
 notification_options r,c,w
 register	0
}

define service {
 name   service_afterhrs
 service_description    service template afterhrs,
 check_period afterhrs
 notification_period afterhrs
 max_check_attempts 5
 normal_check_interval 10
 retry_check_interval 2
 notification interval 30
 notification_options r,c,w
 register       0
}

(service definition)

define service {
	host_name 	host1
	service_description	HTTP
	use service_workhrs
	contact_group 	sys-admin,email
	check_command check_http
}

define service {
        host_name       host1
        service_description     HTTP after hours
        use service_afterhrs
        contact_group   sys-admin,email
        check_command check_http
}

assume contactgroup sys-admin pages oncall and group email sends emails to 
all

so if i wanted to reproduce every check to corresspond with timeperiods,
i'd run into this problem: say HTTP goes down @ 3pm and i acknowledge the
critical. and then we see the sucker's gonna stay broken a while. the
problem will be that @ 11pm, "HTTP after hours" will try to check http and
fail and page out its notification.

i was trying to come up with various scenarious to get around this, via
dependencies, relationship btwn checks, but it's ugly if its possible at
all. so i figured it's either an easy way to do this or else timeperiods
are not meant to be used in such a complicated manner.

because what i'm left with is creating sys-admin-page to page, and
sys-admin-email to only email, making sure the email group runs 24x7 while
the page contact group members will only run for one timeperiod (workhrs).  
and leave the timeperiod out of the service template entirely, also 
cutting out the ability to adjust service check options along with 
timeperiods...

define service {
        host_name       host1
        service_description     HTTP
        use service
        contact_group   sys-admin-page, sys-admin-email
        check_command check_http
}

so then i get paged and recieve email from 8-11pm, but get email only from
11pm-8am. so i do understand that this can work, but is that as far as it
will go?

i started getting the hackneyed idea of using scripts to restart nagios at 
certain times (cron), each time pointing to appropriate set of config 
files. but that is just idiotic - can you imagine the tracking tools 
dealing with that?!

so - any pointers on whether or not the sort of configuration i'm looking
for is possible would be greatly appreciated.

thanks,
sp



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
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