Search All Sites
Nagios Live WebinarsLet our experts show you how Nagios can help your organization.
Don't miss your chance to attend the 2014 Nagios World Conference, Oct 13-16th. Informative Sessions, Networking, Food and Cocktails! Visit go.nagios.com/conference/ for more information or to register.
- Nagios 3.x
the requested data as Nagios Config, XML or JSON encoded data via HTTP
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:
For web access, pass arguments as follows:
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:
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:
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.
- The following example will return all 'servicestatus' objects for 'host1.example.com':
You can also filter which fields are returned for each object by providing a
comma separated list in the 'fields' argument.
- The following example will only return the 'host_name', 'service_desciption',
'current_state' and 'type' fields for all services ('type' is always returned):
For additional performance benefit, you can limit the number of results returned with: