2

How to access Nagios Availability-Report files to retrieve "UP Time Percent" and so other information about Hosts and Services?

I know It can be accessed through Nagios CGI but I want to use it on a custom interface. Can I use those CGI Script to achieve what I want?

Super Mario
  • 355
  • 1
  • 3
  • 7

1 Answers1

5

Looks like the Nagios Availability-Report is generated using the cgi-bin/avail.cgi script looking at the source code for the cgi script it reads the nagios log files and generates the reports on the fly.

You could either pass the arguments to the avail.cgi script or you could parse the nagios.log file and the archives which on my system is located in nagios/var/archives to generate your own reports.

A report for all host groups for the last 7 days with first assumed state as up/ok would look like the following

http://nagios/cgi-bin/avail.cgi?show_log_entries=&hostgroup=all&timeperiod=last7days&smon=12&sday=1&syear=2012&shour=0&smin=0&ssec=0&emon=12&eday=31&eyear=2012&ehour=24&emin=0&esec=0&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=no&initialassumedhoststate=3&initialassumedservicestate=6&backtrack=4

Just as another thought, you could download the CGI script source code and edit it so the output matches your requirement and then compile the CGI and use it.

Epaphus
  • 1,011
  • 6
  • 8
  • Thanks, You mean using the command line options? How can I get the exact value? – Super Mario Dec 31 '12 at 08:21
  • I mean via a web request, you would then either have to just display the web page the script returns or do some thing which would pull out the data you need so that it can be in the same style as the custom UI. You can get the values by going direct to the script in a web browser as all the options look to be passed as a get request. – Epaphus Dec 31 '12 at 11:33
  • updated answer. – Epaphus Dec 31 '12 at 11:39