Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Which custom interface are you using? – Epaphus Dec 29 '12 at 21:18
Thank you. I wrote one in PHP myself. actually It's just something to fulfill my needs. – Super Mario Dec 29 '12 at 21:35
up vote 4 down vote accepted

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


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.

share|improve this answer
Thanks, You mean using the command line options? How can I get the exact value? – Super Mario Dec 31 '12 at 8: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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.