This blog article presents a little tool that might be useful to automatize tasks around Nagios. In every day’s IT administrator tasks the reboot and downtime for servers and services maintenance is not avoidable.
One of the administration tasks in NetEye is also the schedulation of such downtimes in order to avoid predictable alert notifications via eMail and SMS, but also to respect the downtime periods for your SLA statistics.
Here I would like to introduce a little script that allows to setup downtime periods in a direct way via command line. For even repeated events it would be possible to accomplish via cron job.
The script call itself requires just the essential information: The name of the host and the service for which is needed to schedule the downtime. Additional arguments might be the Downtime comment description and the duration.
A possible command call would be: ./schedule_nagios_downtime.pl <nagios host> <nagios service> [<comment> <seconds of downtime>]
You can note that Host and Service Names with non basic-ASCII characters special encoding is required. The replacement for a space is for example a “+”. The result would be as shown below:
To facilitate the discovery of problems the script execution results are kept in a local logfile in /tmp. Just read the file to extract the last execution html:
Just copy it somewhere on your NetEye ( or Nagios installation ) and define within the first lines a few initial things:
the URL to the local or remote cgi
The user to authenticate
The password
That’s it. Now the script should be ready. If the web server’s authentication is correct and the server returns some strings the content is logged in the /tmp/nagios_downtime.html
After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.
Author
Patrick Zambelli
After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.
Rules and standards are important. In a world based on collaboration, following a well defined behavior is key for avoiding errors based on some sort of misunderstanding. This is also true for the world of information technology: someone releases software Read More
With the end of 2021 we've release the first version of the NetEye Extension Packs project that helps customers and consultants on their monitoring implementations and more (see Introducing NetEye Extension Packs | www.neteye-blog.com for details). Now our focus is Read More
SOAP is a messaging protocol for exchanging information based on XML over the network. SOAP messages are written in XML, which is why they are platform- and language-independent. A lot of enterprises have such webservices that return useful data for Read More
The Mod-Gearman packages have been updated with this bugfixes: - add option for forbidden characters in command line - fix segfault on too old host checks - fix segfault on gearmand server errors
Would you like to understand the potential of the ITIL processes implemented with EriZone/OTRS ? Or do you want to deepen your knowledge in the End User Experience monitoring? Or are you curious to know what will be the future Read More
4 Replies to “Automatic Nagios Downtime schedulation script”
sure. The concept is calling the Nagios cmd.cgi with authentication. This means you should adapt the path in line 37 according you check mk version. The indicated path works for NetEye and is different on your installation. User authentication with username and password should be valid, too.
I the result is not visible event after those changes, please un-comment the print() instruction in line 93 to see the generated url and put this directly into your browser. Please check also che /tmp/nagios_downtime log.
http://www.neteye-blog.it/wp-content/uploads/2011/11/schedule_nagios_downtime.pl_.tar.gz
=> 404 not found
Thank you very much for the indication! Now it works again.
Hello
I tried using Check_mk last version, but it doesn’t work
Could you help me
Currently using Centos 7 +Check_mk
Regards
Hello Hector,
sure. The concept is calling the Nagios cmd.cgi with authentication. This means you should adapt the path in line 37 according you check mk version. The indicated path works for NetEye and is different on your installation. User authentication with username and password should be valid, too.
I the result is not visible event after those changes, please un-comment the print() instruction in line 93 to see the generated url and put this directly into your browser. Please check also che /tmp/nagios_downtime log.
Regards,
Patrick