10
Nov/09
1

VBS/Perl: New nagios_downtime scripts

nagios-logoSome days ago I released new versions of my nagios_downtime scripts. The perl edition of the script has been released as version 0.5. The vbs edition for the windows hosts was released as version 0.8. The major change in both editions is the new deletion mode. You can now schedule downtime previous to taking the service/host down as usual. After bringing the service/host back online you can start the nagios_downtime scripts in “del” mode. This will delete the downtime in Nagios. Technical details: The change sounds simple but realizing this was not easy. Finally it bloated up the code of the scripts a lot. The problem is that the response after scheduling the downtime does not contain the an identifier of the downtime. The reason for this is simple, scheduling a downtime and the creation of the downtime in Nagios is handled asynchronous. So it is needed to wait for the downtime being scheduled in Nagios and then reading the matching downtime id to delete it later. That was the simple part: The possibility to chedule multiple downtimes for the same service/host with same or different durations can result in problems, that the nagios_downtime scripts don’t know which downtime was triggered by them and which downtime the script are permitted to delete afterwards. Trying to find the perfect solution for that I decided to include a nagios_downtime “internal downtime id” which is basically the current timestamp. The “internal downtime id” is appended to all downtime comments and stored in a temporary file on the local disk when scheduling the downtime. So it can be read from the file when the script is called to delete the downtime. Then all current downtimes are read from Nagios and the “internal downtime id” is translated to the real Nagios downtime id. Using this downtime id the downtime can finally be deleted.

Read more about the nagios_downtime scripts on the project page.

Filed under: Nagios
Comments (0) Trackbacks (1)