R: scripts to schedule downtime via crontab

Marco Borsani m.borsani at it.net
Tue Nov 6 14:35:43 CET 2007


Hi
 
You post a script really similar to mine.
 
I am looking for the www.nagios.org site, but I do not find nor example
regarding 2.10 version neither which are "extra parameters" to pass to the
command file.
 
Regards
Marco


  _____  

Da: Giles Coochey [mailto:gcoochey at sapphire.gi] 
Inviato: martedì 6 novembre 2007 11.55
A: Marco Borsani; Nagios List
Oggetto: RE: [Nagios-users] scripts to schedule downtime via crontab



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: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Marco
Borsani
Sent: 06 November 2007 11:43
To: nagios-users at lists.sourceforge.net
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;$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/3381f6eb/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