Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
This script will parse the Nagios status cache file and return the requested data as Nagios Config, XML or JSON encoded data via HTTP or STDOUT.
Current Version
1.0
Last Release Date
2013-10-20
Owner
Ryan Armstrong
Website
http://cavaliercoder.com
License
GPL
Compatible With
This script will reparse the source files with each request so please be mindful of impact to disk IO and CPU load in larger environments. For best performance, move your Nagios data to a shared memory location such as /dev/shm. Copy or link this script to <nagios_path>/sbin and access it via: http://<nagios_url>/nagios/cgi-bin/ajax.cgi For web access, pass arguments as follows: http://<nagios_url>/nagios/cgi-bin/ajax.cgi?<arg1>=<val1>&<arg2>=<arg2>... For shell/STDOUT, pass arguments as follows: ./ajax.cgi <arg1>=<val1> <arg2>=<val2>... If no arguments are passed, the script will parse and return all status data. The location of the Nagios status file can be set below in STATUS_FILE or as a command argument with: status_file=<status_file> Multiple formats are available including plain text (in Nagios config format), XML and JSON. The default for all web requests is JSON while the default for STDOUT is plain text. Specify the desired format with: format=<xml|json|text> To filter the return data, simply provide the Nagios field name and value for the desired data. Pseudo field 'type' is provided for filtering object types. Example: - The following example will return all 'servicestatus' objects for 'host1.example.com': http://<nagios_url>/nagios/cgi-bin/ajax.cgi?type=servicestatus&host_name=host1.example.com You can also filter which fields are returned for each object by providing a comma separated list in the 'fields' argument. Example: - The following example will only return the 'host_name', 'service_desciption', 'current_state' and 'type' fields for all services ('type' is always returned): http://.../ajax.cgi?type=servicestatus&fields=host_name,service_description,current_state For additional performance benefit, you can limit the number of results returned with: result_limit=n
You must be logged in to submit a review.
To:
From: