Managers like statistics. And they like it on a regular basis: Daily, Monthly, Trimestrial, Yearly... and so on. The Availability Reports created by Nagios are a very good indication for the availability of services so why not use these stats. There's only one small problem: Nagios doesn't support an export as PDF (yet). But with some tweaks this can be done in a couple of minutes. Here's a small howto:
- Linux server
- Nagios running (of course)
- You need to download and install html2ps
1) Download Availability Report of service 'Website' using your Nagios user (nagiosadmin for example):
wget --user nagiosadmin --password nagiospass -O /tmp/report -q "http://mynagios.server.local/nagios/cgi-bin/avail.cgi?show_log_entries=&host=HOST&service=Website&timeperiod=yesterday"
Note the bold marked params. HOST is of course the server you're monitoring on which the service 'Website' is running. Here we set the timeperiod to yesterday for a daily basis.
1b - optional)
By default, the reports will be in black/white (text only). If you
want to make it a bit more colorful you may replace the css classes from
the html code into bgcolors. Here's an example to change the
'ServiceOK' class to a green background colour:
sed -e 's/CLASS='\''serviceOK'\''/BGCOLOR='\''#00FF00'\''/g' /tmp/report > /tmp/report.tmp
mv /tmp/report.tmp /tmp/report
2) Convert the downloaded html file to ps (post script) using html2ps:
/usr/bin/html2ps -U /tmp/report > /tmp/report.ps
The paremeter -U allows to create a post script file with colours. This is necessary if you replaced the css classes by bgcolors.
3) Convert the ps file into pdf
ps2pdf /tmp/report.ps /tmp/report.pdf
Of course you can auto-generate the reports now with these commands. I am generating several reports of services and servicegroups on a daily basis.