Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Nagios Core up and running, and cannot find any way to schedule a regular period of downtime for hosts. For example, let's say I have a host that is scheduled to reboot itself every Sunday at 1 am. I'd like to be able to schedule that known downtime of "every Sunday from 1:00am to 1:10am" into Nagios, but the only way I see to do so is one event at a time.

share|improve this question
2  
Just curious why you would be rebooting a server that's unattended on a schedule like that? It seems like not such a good idea. –  MDMarra Aug 3 '11 at 14:36
2  
There is no option like this because it's generaly seen as bad practice to periodicly reboot a server. If your server requires a reboot every week you should try and find out why it does and resolve the issue rather than rebooting it every week. –  Bart De Vos Aug 3 '11 at 14:47
1  
It's generally seen as a good practice to periodically reboot your server to make sure it still boots (e.g., the startup scripts did not get broken). The worst time to find that your server doesn't boot successfully is during an emergency unscheduled reboot. –  Mark Wagner Aug 3 '11 at 16:45
    
@embobo But every week... That's a bit harsh. Just do it whenever you apply a patch or make some major change. There is no need for a weekly reboot. –  Bart De Vos Aug 4 '11 at 13:14

2 Answers 2

up vote 5 down vote accepted

Without using the cron solution mentioned by JakePaulus the typical method for handling "downtime" with Nagios is to define and use a timeperiod that does not include the time during which the host will be down. E.g., in your case

define timeperiod {
  timeperiod_name foo
  sunday 00:00-1:00,1:10-24:00
  monday 00:00-24:00
  tuesday 00:00-24:00
  wednesday 00:00-24:00
  thursday 00:00-24:00
  friday 00:00-24:00
  saturday 00:00-24:00
}

A simpler method is to take your pre-existing 24x7 timeperiod and define and exclusion:

define timeperiod {
  name reboot
  timeperiod_name reboot
  sunday 1:00-1:10
}

define timeperiod {
  timeperiod_name foo
  use 24x7
  exclude reboot
}
share|improve this answer
    
The only problem with scheduling checks to only occur outside of scheduled downtime is it doesn't allow you to keep track of how much actual downtime has occurred including scheduled maintenance. This might be important for some people to track. –  JakePaulus Aug 5 '11 at 3:16
1  
@JakePaulus This timeperiod could be applied to notifications only; thus the downtime during this period would be tracked. I purposely didn't say where in the nagios config to use the timeperiod because it depends on your needs. –  Mark Wagner Aug 5 '11 at 17:43
    
if one were to apply this time period to the notifications, then availability reports would not have a way to differentiate scheduled vs. unscheduled downtime. –  JakePaulus Aug 5 '11 at 22:42

You can do this using a shell script that submits an external command (outputs a command to the named pipe nagios.cmd file) on a schedule dictated by cron. Here's a link to what we use.

http://exchange.nagios.org/directory/Addons/Scheduled-Downtime/Schedule-Downtime-via-cron/details

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.