scripts to schedule downtime via crontab

Marco Borsani m.borsani at it.net
Tue Nov 6 11:43:05 CET 2007


Hi all
 
On my nagios 1.4.1 I am using script to schedule downtime like these:
----------------------------------
HOST Downtime
#!/bin/sh

datetime=$(/usr/bin/perl -e 'print(time)')
 
hostname=$1
start_time=$datetime
duration=$2
(( end_time = $datetime + $duration ))
fixed=1
comment_author=nagios
comment_data="Downtime di Host"
 
echocmd="/bin/echo"
 
CommandFile="/usr/local/nagios2/var/rw/nagios.cmd"

# create the command line to add to the command file
cmdline="[$datetime]
SCHEDULE_HOST_DOWNTIME;$hostname;$start_time;$end_time;$fixed;$duration;$com
ment_auth
or;$comment_data"
 
# append the command to the end of the command file
`$echocmd $cmdline >> $CommandFile`
chown nagios:nagiocmd $CommandFile
--------------------------------------
SERVICE Downtime
#!/bin/sh
 
datetime=$(/usr/bin/perl -e 'print(time)')
 
hostname=$1
service_des=$2
start_time=$datetime
duration=$3
(( end_time = $datetime + $duration ))
fixed=1
comment_author=nagios
comment_data="Downtime di Servizio"
 
echocmd="/bin/echo"
 
CommandFile="/usr/local/nagios2/var/rw/nagios.cmd"

# create the command line to add to the command file
cmdline="[$datetime]
SCHEDULE_SVC_DOWNTIME;$hostname;$service_des;$start_time;$end_time;$fixed;$d
uration;$
comment_author;$comment_data"
 
# append the command to the end of the command file
`$echocmd $cmdline >> $CommandFile`
chown nagios:nagiocmd $CommandFile
-----------------------------------
 
These scripts do not work on Nagios 2.10 ... have anyone something similar
for Nagios 2.10 ?
 
Regards

Marco Borsani
Technical Operation

tel.:    +390104310115
e-fax: +390683175950
*       m.borsani at it.net

ITnet S.r.l.
Direzione e Coordinamento di Weather Investments S.p.A.
Via Pacinotti, 39
16151 - Genova


In ottemperanza al D. lgs 196/03 in materia di protezione dei dati
personali, le informazioni contenute in questo messaggio sono strettamente
riservate e sono esclusivamente indirizzate al destinatario indicato (oppure
alla persona responsabile di rimetterlo al destinatario). Qualsiasi uso,
riproduzione o divulgazione di questo messaggio è vietata. Nel caso in cui
aveste ricevuto questa mail per errore, Vi invitiamo ad avvertire il
mittente al più presto a mezzo posta elettronica e distruggere il messaggio
erroneamente ricevuto.

According to Italy’s new data protection code (Legislative Decree no.
196/2003) in force on January 1st 2004, Italian Law 196/03 concerning
privacy, the information contained in this e-mail is confidential and is
intended for the addressee only. If you are not the correct recipient,
please note that any use, dissemination or copy of this document/information
is strictly prohibited.If you have received this message in error, you
should destroy it and please notify us immediately by e-mail.

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20071106/81d18e0e/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
-------------- 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