skip monitoring every 4 weeks

Kevin Keane subscription at kkeane.com
Thu Jan 29 15:22:33 CET 2009


What you are describing is, in more generic terms, a maintenance window.

I'm actually using a very different approach for the same basic problem:
I schedule downtime for that maintenance window. Now Nagios doesn't
support recurring scheduled downtimes directly. The solution is a script
(this one has hardcoded 2 hours scheduled downtime - change as needed).

#!/bin/bash
# schedules downtime for the host given in $1

now=$(date +%s)
read host
read comment

# the host may need to be capitalized. To find the correct version,
parse the Nagios config files:
fixed_host=$(grep -ri "host_name.*$host" /etc/nagios/objects | uniq |
awk '{ print $3; }')

NAGIOSCMD="[$now]
SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME;$fixed_host;$now;$(($now+7200));1;0;7200;Kevin 

Keane;$comment"
echo -e $NAGIOSCMD "\n" > /var/spool/nagios/nagios.cmd

In my case, the backup script also calls this one. You may instead want
to use cron, or you could invoke it from a shutdown script in the server
being rebooted, remotely via ssh.



Assaf Flatto wrote:
> Hello 
>
> I have a situation where i need to turn of monitoring for server while they are being rebooted , 
> this is done during the weekend , and the person doing the reboots is not one that has access to
> the nagios .
>
> i know that Version 3 placed the functionality of alternating and dynamic scheduling in the 
> timeperiods definitions , but after reading the online documentation , i'm not realy clear on ho i 
> can achieve my gaol.
>
> I need the monitoring for a server to be stopped during a period (specific times TBD ) every 4th 
> weekend , (Sunday or Saturday , again yet to be determined ).
>
> I understand that I need to define a time period and add an "exclude"  to the time period the host 
> in question has defined .
>
> My issue is with the correct format of the "skipped" timeperiod .
> Is what I'm defining below correct in format and functionality  - if not in strict content  ?
>
> define timeperiod{
>        timeperiod_name weekend-off
>        Sunday /28              00:00-24:00
>        }
>
> define timeperiod{
>        timeperiod_name box-reboot
>        use             24x7
>        exclude         offweekend
> }
>
>
> Thanks
>
>
>   


-- 
Kevin Keane
Owner
The NetTech
Find the Uncommon: Expert Solutions for a Network You Never Have to 
Think About

Office: 866-642-7116
http://www.4nettech.com

This e-mail and attachments, if any, may contain confidential and/or 
proprietary information. Please be advised that the unauthorized use or 
disclosure of the information is strictly prohibited. The information 
herein is intended only for use by the intended recipient(s) named 
above. If you have received this transmission in error, please notify 
the sender immediately and permanently delete the e-mail and any copies, 
printouts or attachments thereof.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
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