<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<br><br><hr id="stopSpelling">From: tom.sturme@live.nl<br>To: nagios-users-request@lists.sourceforge.net<br>Subject: Donwtime_sched not working correctly<br>Date: Wed, 23 Mar 2011 13:00:34 +0100<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
Hi,<br><br>I'm trying to run downtime_sched 3.2 with nagios 3.2.2<br><br>I've done the steps that are defined in the readme file.<br><br>If I
define a downtime in the webinterface for example a host, it doesn't
actually schedule the downtime, sow the host doesn't go into the
downtime.<br><br>My files look like this:<br><b>Downtime_job.pl</b><br><br>#!/usr/bin/perl<br># vim:ts=4<br>#<br># this should be run regularly from your crontabs, to schedule any outages<br># for the forthcoming 24 hours.<br><br># Daily: <br># crontabs: 01 07 * * * downtime_job.pl > /dev/null 2>&1<br># Hourly:<br># crontabs: 01 * * * * downtime_job.pl > /dev/null 2>&1<br><br># WARNING! Only minor verification is made on the config file. If you give <br># incorrect hostnames, service descriptions, or hostgrouname then it<br># will not be noticed until Nagios tries to parse the command!<br><br># See companion file for example of structure of schedule.cfg file.<br>#<br># Version 1.1 : fixed for nagios 1.2<br># Version 1.2 : trim trailing spaces from parameters, allow smaller increments<br># Version 1.3 : allow wildcards in service name, check for already sched<br># 1.5 : optimisation<br># 1.6 : fix lookahead correctly, big rewrite<br># 2.0 : Nagios 2 support<br># 2.1 : Fix split regexp to allow spaces as well as commas<br># 3.0 : Nagios 3 support<br># 3.1 : Month days error<br># 3.2 : Month day errors, leap year corrections<br><br>use strict;<br>use Time::Local;<br><br>my($NAGDIR) = "/usr/local/lib/nagios" ; # Nagios root directory<br>my($NAGVER) = 3; # 1 2 or 3<br>my($SVCALSO) = 0; # schedule outages for services on hosts as well as hosts?<br><br>my($OBJECTS,$RETENTIONDAT,$STATUSDAT,$DOWNDAT,$STATUSLOG,$HGCFG,$DOWNLOG)<br> = ('','','','','','','');<br><br># Always define these<br>my($CFGFILE) = "$NAGDIR/etc/schedule.cfg"; # my configuration file<br>my($CMDFILE) = "/var/run/nagios/rw/nagios.cmd"; # Nagios CMD file<br># Define this for Nagios 2 or 3<br>$OBJECTS = "$NAGDIR/log/objects.cache" # Nagios 2/3 objects file<br> if( $NAGVER>1 );<br># Define this for Nagios 3<br>$STATUSDAT = "$NAGDIR/log/status.dat" # Nagios status file<br> if( $NAGVER > 2 );<br>$RETENTIONDAT = "$NAGDIR/log/retention.dat" # Nagios retained status file<br> if( $NAGVER > 2 );<br># Define this for Nagios 2<br>$DOWNDAT = "$NAGDIR/log/downtime.dat" # Nagios 2 existing downtime<br> if( $NAGVER >= 2 and $NAGVER < 3 );<br># Or these for Nagios 1<br>if( $NAGVER < 2 ) {<br> $STATUSLOG = "$NAGDIR/log/status.log"; # Nagios status log file<br> $HGCFG = "$NAGDIR/etc/hostgroups.cfg";# hostgroup definitions<br> $DOWNLOG = "$NAGDIR/log/downtime.log"; # existing sched downtime<br>}<br><br>my($FREQUENCY) = 1440*7; # how many minutes to look ahead. Should be at least<br> # 1440 (one day) and <= 1 week. Only the next outage<br> # is scheduled, not all of them.<br>my($MINDUR) = 5; # shortest outage allowed in minutes<br>my($DEBUG) = 0; # set to 1 to produce helpful debugging information<br>my($rv);<br><br># Nothing more to change after this point!<br><br>ect.<br><br><b>Downtime_sched.cgi</b><br><br>#!/usr/bin/perl<br># vim:ts=4<br>#<br># Steve Shipway<br># View and modify the recurring downtime schedules for Nagios<br># These are activated by the downtime_job.pl script in Nagios' crontabs<br><br># TO DO: Add authentication to this, so you can only schedule for your own<br># hosts and hostgroups!<br>#<br># Version 1.3: added verification of host and service names, allow wildcards<br># Version 1.4: More validity checks<br># 1.6: no real changes<br># 2.0: nagios 2.x support<br># 3.0: nagios 3.x support<br><br>use strict;<br>use CGI;<br><br>my($NAGIOS) = "/usr/local/lib/nagios";<br>my($CFGFILE) = "$NAGIOS/etc/schedule.cfg"; # My config file!<br>my($CMDCGI) = "/nagios/cgi-bin/cmd.cgi";<br><br># If you have Nagios 1.x define this<br>my($STATUSLOG) = "$NAGIOS/log/status.log";# if defined, check validity<br># If you have Nagios 2.x or 3.x, define this<br>my($OBJECTS) = "$NAGIOS/log/objects.cache";# if defined, use nagios2 cache<br><br>my($USER);<br>my($DEBUG) = 0;<br>my($rv);<br>my( @schedules ) = ();<br>my($q,$cmd,$seq,$type);<br>my(%hostsvc,%hgroup);<br><br>ect.<br><br><b>Crontab</b><br># /etc/crontab: system-wide crontab<br># Unlike any other crontab you don't have to run the `crontab'<br># command to install the new version when you edit this file<br># and files in /etc/cron.d. These files also have username fields,<br># that none of the other crontabs do.<br><br>SHELL=/bin/sh<br>PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br><br># m h dom mon dow user command<br>17 * * * * root cd / && run-parts --report /etc/cron.hourly<br>25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )<br>47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )<br>52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )<br>01 * * * * /usr/local/lib/nagios/downtime_job.pl >/usr/local/nagios/logs/downtime.log 2>&1<br>#<br><br><br>Am I doing something wrong? Or are I'm forgetting something?<br><br>Help would be appreciated.<br><br>Cheers,<br><br>Sturme<br><br> </body>
</html>