scripts to schedule downtime via crontab

Giles Coochey gcoochey at sapphire.gi
Tue Nov 6 14:39:51 CET 2007


>From the page I linked to:

 

"Set the "trigger_id" argument to zero (0) if the downtime for the specified host should not be triggered by another downtime entry."

 

I don't believe you have a trigger_id set in your script. Try inserting it and see whether that resolves the issue.

 

Check this page, for a similar variable in your service downtime script:

 

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

 

 

________________________________

From: Marco Borsani [mailto:m.borsani at it.net] 
Sent: 06 November 2007 14:36
To: Giles Coochey; 'Nagios List'
Subject: R: [Nagios-users] scripts to schedule downtime via crontab

 

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;$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
	*       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/e8bae4cf/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