I had to create a script that will output every host that has went down in the past day and how many times that host went down and at what times did that host go down and when it came back up in a nice readable format ( Executives who do not know what they are looking at ). Now this is the first release of my script and I do mean first release as I really want to expand it to not just do daily reports from nagios.log but as well as get the archives and any to pass it dates.
I hope you Nagios users who have to send reports to your executives find this script useful but check back soon as I’m going to be adding more to it or even changing it into its own class. As of right now it consist of three functions. The only draw back of the script is that it takes a while to parse the log file since it has to find all the uniq hosts in nagios.log and find only the hard down and hard up events compared to the uniq hosts.
For now I run this script in cron at 6AM and have the txt file that it creates sent to a list of users at 7AM on a daily basis. Again this is my first revision it will go through alot more and if you have suggestions or you have expanded on this script by all means let me know so I can post it up here or you can become a member and post it yourself. Also if you have request please become a member and ask in the forums section.
Cambid, fixed the regex in the script. It should now match correctly in all environments!
Continue reading “Daily Nagios Report Python Script Part One” »