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