nagios_downtime scripts
Brief Description
The Nagios downtime scripts have been created to automatically schedule downtimes to Nagios when taking down monitored hosts and/or services. Scheduling downtimes in Nagios during maintenances is important to suppress needless notifications and to differ planned downtimes from others in reportings.
What is special?
The downtime scripts for Nagios communicate with Nagios using the classic CGI interface to schedule and delete downtimes. This has been realized this way to have no additional service listening on the Nagios server.
The Nagios downtime scripts are available in Perl and Visual Basic Script (vbs). The perl scripts have been developed for Linux/Unix platforms and should work on most Linux distributions out of the box. The vbs edition of the script have been created using Windows XP and 2003 and should work on newest Windows systems without any additional software.
Since version 0.5 of the perl edition and 0.8 of the vbs edition it is possible to delete previously scheduled downtimes before the end of the downtime calling the script in “deletion” mode. For details about this feature take a look at the help output of the scripts.
Purposes
You may call the script post shutting down a machine. In case of a Linux server you might use the provided init script to schedule a downtime when restarting or shutting down the system to inform the Nagios server about the planned downtime. Similar solutions can be used on Windows servers using shutdown scripts.
The nagios_downtime scripts can also be called using schedulers like the cron daemon for scheduling downtimes for hosts and/or services on a regular base.
Links
The Nagios downtime scripts are hosted on Nagios forge Nagiosforge has been closed. The files are now directly available via Git. Maybe i’ll pack future releases – the git must be enough for the moment.







11:35 on November 30th, 2009
This script looks awesome. Gave it a quick test and it worked fine. This will be quite helpful for us! Thank you
14:34 on January 13th, 2010
Thanks for the improvements on your command line tool. I’ve been using version 0.3 for a long time and haven’t checked back to see about a new version until today. I like all the additions and improvements on the scripts!
08:15 on May 28th, 2010
Ja sehr schön, es gefällt
GPO und somit ist das “happy rebooting” Problem auch erschlagen. DANKE für das Skript!
PS: Fehlt nur noch ein Downtime Taskplaner in Multisite g
13:11 on May 28th, 2010
Ja, die Reboot-Probleme kenne ich nur zu gut
. Freut mich, dass das Script etwas nützt.
Grüße, Lars
11:13 on June 9th, 2010
Sag mal kann ich auch ein Silent Submit machen? Weil in der GPO haben mir die Windows Admins eine auf die Mütze gehauen, da beim herunterfahren noch “OK” angeklickt werden muss… Das ist nicht so toll, wenn jemand z.B. eine VM Host herunterfährt, und nicht vor dem System sitzt und die Meldung quittiert.
19:21 on June 15th, 2010
Wir habn ja schon drüber geschrieben. Einfach das Script per cscript.exe aufrufen.
15:24 on August 13th, 2010
Hallo, ich möchte hier einfach nochmal auf das Script hinweisen, das ich von dir geändert habe, damit es auch unter Red Hat und Fedora Systemen läuft.
http://www.nagios-portal.org/w.....post131960
Es wäre für andere sehr hilfreich, wenn du das noch irgendwie mit einbringen könntest.
Gruß Marco
17:28 on August 14th, 2010
Ist drin. Habs noch etwas angepasst.
Grüße, Lars
13:21 on November 8th, 2010
Die Links zu den Downloads sowie der Projekthomepage funktionieren leider nicht mehr. Kann mit jemand die Scripte zur Verfügung stellen? Danke und Gruß,
Stefan
19:30 on November 8th, 2010
Hallo Stefan,
na super. Da kannst du dich nun beim “fatherofnagios” (Ethan Galstad) bedanken. Er hat im Zuge des Markenstreits um Nagios die Domains von Netways eingesammelt und nun scheinbar die Domains umgebogen.
Tolle Wurst … na dann muss ich mal schauen, wo und wie und was … dauert etwas.
Grüße, Lars
19:56 on November 22nd, 2010
Hi, ich finde das Skript sehr hilfreich. Leider stimmt das Datum nicht, welches das Perl-Skript einträgt. Die Uhrzeit stimmt jedes Mal, aber das Datum, an dem die Downtime starten soll liegt in der Zukunft. z.B. 11-10-2011 statt 22.11.2010 ! Woran kann’s liegen ? Die Systemzeit ist jedenfalls korrekt eingestellt.
Viele Grüße, Daniel
20:32 on November 23rd, 2010
Hallo, das Problem mit dem falschen Datum in der Downtime ist erledigt. Hatte vergessen date_format anzupassen.
ciao, Daniel
13:44 on December 19th, 2010
Hallo, funktioniert echt Klasse, jedoch kann man keinen Kommentar mit der Option -c übergeben.
nachdem ich folgende Zeile “c|comment=i” => \$downtimeComment, in “c|comment=s” => \$downtimeComment geändert habe funktioniert auch das
Mfg Conny
14:26 on January 19th, 2011
Hallo ich find es auch echt toll. Allerdings habe ich ein Problem beim löschen der Downtime über das Skript!!! Wenn ich die Downtime löschen will bekomme ich immer folgende Fehlermeldung: EROR could not open temporary file (C:\Users\Benutzername\AppData\Local\Temp\”Name des Host”-”Name des Service”.txt)
hat jemand eine Idee woran das liegen könnte?!
18:41 on January 24th, 2011
I also have the same issue as Lichtii, where I get the following when trying to remove the downtme scheduled using the .vbs script “ERROR could not open temporary file”. It seems as if it’s not even creating the file. I look in the directory after a successful downtime scheduling, but there is not a .txt file there. Anyone have any ideas?
01:06 on January 25th, 2011
This section of code: Case 2 If InStr(oBrowser.ResponseText, “Your command requests were successfully submitted to”) > 0 Then ‘ Save the id of the just scheduled downtime If storeDowntimeIds = 1 Then saveDowntimeId()
needs to be changed to this
Case 2 If InStr(oBrowser.ResponseText, “Your command requests were successfully submitted to”) > 0 Or InStr(oBrowser.ResponseText, “Your command request was successfully submitted to”) > 0 Then ‘ Save the id of the just scheduled downtime If storeDowntimeIds = 1 Then saveDowntimeId()
To have proper logic control, and account for a slightly different responseText message for a successful request.
19:25 on January 26th, 2011
Hello Guys,
I added the changes from Rob to the current git code. I have no windows host here at the moment. Can anyone check it out and test it?
10:35 on February 2nd, 2011
Könnt Ihr die Änderungen bitte noch mal überprüfen ich bekomme vom Windows Scripting Host die Meldung: Zeile: 681 Zeichen: 4 Fehler: ‘End’ erwartet Code: 800A03F6
mfg
13:48 on February 2nd, 2011
Hallo Lars, schließe mich meinem Vorgänger (lichtii) an (…auch, um die Dringlichkeit des Anliegens zu erhöhen). Selber fehlt mir leider das KnowHow, um das Problem bewältigen zu können. Danke für das Engagement!
08:58 on February 4th, 2011
Hallo Lars, leider funktioniert das Script bei mir überhaupt nicht. Ich versuche die Perl-Version auf einem Linux-System per CLI auszuführen und der Befehl wird auch abgesetzt. Unser Webserver für Nagios macht eine NTLM-Auth. Nun kommt das Script aber nicht mit einem User am Webserver zur authentifizierung an, sondern als Anonymous. Gibt es dafür eine Abhilfe? THX
18:14 on February 7th, 2011
@Olga: Ich sehe spontan zwei Wege:
19:24 on February 7th, 2011
Hallo Mario, lichti,
ich habe nun die Syntaxfehler gefixt. Allerdings habe ich das Script bisher nicht auf Funktion getestet. Bitte schaut es euch mal an.
10:52 on February 9th, 2011
SPITZE!!!! jetzt funktioniert es!
DANKE
08:31 on February 14th, 2011
100%ig! Merci beaucoup!
19:27 on May 9th, 2011
Hallo. Ich hab Probleme mit dem Script unter Linux. es kommt die Meldung
ERROR: HTTP Response code 4xx says “client error” (401) Hint: This could be caused by wrong auth credentials and/or datetime settings in this script
Die Parameter sind gesetzt wie bei einem Win-System. Da klappt es einwandfrei.
00:50 on August 30th, 2011
Hallo, ich habe auch das Problem unter Linux: ERROR: HTTP Response code 4xx says “client error” (401) Hint: This could be caused by wrong auth credentials and/or datetime settings in this script
Auch bei mir funktioniert das vbs-Script unter Windows einwandfrei.
23:47 on September 2nd, 2011
Ist der Auth Realm korrekt gesetzt? Im Script ist “Nagios Access” als Default codiert. Was zeigt der Browser bei der Passwort Eingabe an?
Dafür gibt es momentan noch keinen Parameter.
Ansonsten das Script mal mit -d aufrufen und hier posten.
00:22 on September 3rd, 2011
Hallo, es war tatsächlich der Auth Realm. Beim vbs-Script stand bei mir auch was falsches drin, es ging aber trotzdem. Daher habe ich nicht an dieser Stelle gesucht.
Es funktioniert auf jedenfall jetzt einwand frei.
Danke
09:28 on November 15th, 2011
Hallo, ist es möglich mit diesem Script für alle Services, die einem Host zugewiesen sind eine Downtime einzurichten. In der WebGUI heißt die option “schedule triggered downtime for all child hosts”
Hello is it possible to define for all services which are declared for one Host to set a downtime. In the GUI it called “schedule triggered downtime for all child hosts”
Thanks
15:09 on November 20th, 2011
At the moment this is not possible. I just sent you an email.
12:18 on February 9th, 2012
Ein sehr nützliches Skript! Mir ist aufgefallen, dass es üblicherweise seine Meldungen mit Wscript.Echo ausgibt, also Meldungsfenster erscheinen, die mit “OK” bestätigt werden müssen. Bei einem Shutdown-Skript, ist das eher hinderlich, es soll ja “still” abgearbeitet werden. Eine Umstellung auf Ereignisprotokollierung würde ich begrüßen, wobei dann die Meldungstexte noch etwas geändert und ergänzt werden müssten. Z.B. Zeile 375: WScript.echo “OK: Downtime was submitted successfully” ersetzen durch: set oShell = CreateObject(“WScript.Shell”) oShell.LogEvent EVENTLOG_SUCCESS, WScript.ScriptName & “: Downtime was submitted successfully” set oShell = Nothing
10:40 on February 10th, 2012
Hm, das mit den Meldungsfenstern war wohl ein Anfängerfehler: Wenn das Skript mit “cscript nagios_downtime.vbs” aufgerufen wird, erscheinen alle Ausgaben in einem Konsolenfenster (DOS-Box). Da muss dann nichts mehr bestätigt werden. Allerdings wird man die Ausgaben in den meisten Fällen nicht lesen können, da das Konsolenfenster sofort wieder geschlossen wird, wenn das Skript fertig ist. Deshalb wäre eine Eventlog-Protokollierung als Option schon gut.
14:12 on February 10th, 2012
Noch zwei Dinge:
1. ‘ 2011-01-26 v0.8.2 – Applied changes to better handle nagios response texts. ‘ Might fix a problem with deleting downtims (Thx Rob Sampson) … ‘ Script version version = “0.8.1″
2. Die internen Downtime-IDs werden in einer Datei in %temp% gespeichert. Nun kann es vorkommen, dass die Downtime abgelaufen ist. Versucht man dann, die (letzte) Downtime zu löschen, wird sie in Nagios nicht gefunden, und das Skript beendet sich mit einer Fehlermeldung. Trotzdem schreibt es die interne Downtime-ID wieder in die Datei. Auf diese Weise sammeln sich mit der Zeit immer mehr Downtime-IDs in der Datei, die im Nagios schon gar nicht mehr existieren. Abhilfe: Zumindest die beim Löschversuch nicht im Nagios gefundene Downtime-ID aus der Datei löschen. Noch besser wäre eine Cleanup-Funktion, die die gespeicherten Downtime-IDs mit Nagios abgleicht und alle nicht gefundenen löscht.
16:56 on February 14th, 2012
Hi, I have added some features to your vbs script:
added the -e switch to optionally enable windows event log logging
added the required functionality for the -e switch
added a “clean” mode. It’s purpose is to cleanup the internal downtime id store file for a host/service. If downtimes expire, over time the internal downtime id store file gets filled with expired downtime ids.
added the required functionality for the “clean” mode
enhanced the “del” function to delete internal ids from the store file if it cannot find the id on the nagios server
I would provide you the complete modified script. Should I e-mail it to the address found in the Impressum?
16:59 on February 14th, 2012
Cool! Sounds good. Yes, please send the changed script to that mail adress. I’ll add it to the git.
13:53 on January 24th, 2013
Hello,
did you ever tryed this with Icinga ? Work well to setup a downtime but the del mode dont work. Iam getting the following error:
OK: Got downtime response from nagios server Translated downtime id: 1359031242(internal) => (Nagios) ERROR: Unable to remove the downtime. Nagios downtime not found. Maybe already deleted? Or not scheduled yet?
Any sugestions how to fix this ?
Greetings
Teiwaz
15:07 on January 24th, 2013
With icinga-web 1.8.1 the delete Funktion dont work. He cant get the Icinga Downtime ID from the CGI ! Anyone having the error too ?
22:36 on May 15th, 2013
Der Link ins Git führt ins Leere. 404 – No such project
Gibt es die Skripte noch an anderer Stelle?
17:29 on May 16th, 2013
Danke für den Hinweis. Das Git ist unter der Adresse nun wieder erreichbar.