From: 
http://www.nagios.org/developerinfo/externalcommands/commandinfo.php?command_id=118



#!/bin/sh

# This is a sample shell script showing how you can submit the 
SCHEDULE_HOST_DOWNTIME command

# to Nagios.  Adjust variables to fit your environment as necessary.



now=`date +%s`

commandfile='/usr/local/nagios/var/rw/nagios.cmd'



/bin/printf "[%lu] 
SCHEDULE_HOST_DOWNTIME;host1;1110741500;1110748700;0;0;7200;Some One;Some 
Downtime Comment\n" $now > $commandfile



It appears to me that there are some extra parameters in there from version 
1.4.1



________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Borsani
Sent: 06 November 2007 11:43
To: [email protected]
Subject: [Nagios-users] scripts to schedule downtime via crontab



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;$comment_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;$duration;$
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
*       [EMAIL PROTECTED]

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.



-------------------------------------------------------------------------
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/
_______________________________________________
Nagios-users mailing list
[email protected]
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

Reply via email to