Home Directory Addons APIs JSON status-json

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

status-json

Rating
2 votes
Favoured:
1
Current Version
2.0
Last Release Date
2012-03-06
Compatible With
  • Nagios 3.x
License
GPL
Hits
114574
Files:
FileDescription
status-json.cstatus-json.c source code with D. Atansov's bug fix
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
status-json duplicates the output of status.cgi in JSON format to make it easier for other applications/services to use Nagios data.

To compile:
1. Copy status-json.c into $NAGIOS_DIR/cgi/
2. cd $NAGIOS_DIR/cgi/
3. Execute the command below to compile status-json.c into status-json.cgi
gcc -g -O2 -DHAVE_CONFIG_H -DNSCGI -o status-json.cgi status-json.c getcgi.o cgiutils.o cgiauth.o macros-cgi.o skiplist.o objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../common/shared.o

Updated 7 March 2012: Thanks to Doychin Atanasov for making some changes to fix problems with honoring disabled notifications and acknowledged states.

Updated 6 March 2017: Thanks to everyone who has used status-json, or who has made improvements to it, or who has had questions about it. We're no longer using Nagios at my site, so I am not able to promise ongoing support for status-json. I've updated the source to include instructions for compiling status-json with gcc.
status-json duplicates the output of status.cgi in JSON format. Compile status-json.c to create status-json.cgi. status-json.cgi accepts exactly the same URL parameters that status.cgi accepts, and filters its output appropriately.

To compile:
1. Copy status-json.c into $NAGIOS_DIR/cgi/
2. cd $NAGIOS_DIR/cgi/
3. Execute the command below to compile status-json.c into status-json.cgi
gcc -g -O2 -DHAVE_CONFIG_H -DNSCGI -o status-json.cgi status-json.c getcgi.o cgiutils.o cgiauth.o macros-cgi.o skiplist.o objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o ../common/shared.o

Note that status-json.cgi only returns the service/host/servicegroup/hostgroup data that appears in the "status" table of status.cgi. It does not return the top portion of the page. I will add this functionality in the next version.

Updated 7 March 2012: Thanks to Doychin Atanasov for making some changes to fix problems with honoring disabled notifications and acknowledged states.

Updated 6 March 2017: Thanks to everyone who has used status-json, or who has made improvements to it, or who has had questions about it. We're no longer using Nagios at my site, so I am not able to promise ongoing support for status-json. I've updated the source to include instructions for compiling status-json with gcc.
Reviews (1)
byskipper, August 11, 2016
Here is the way to compile it (could be useful):
cd ./nagios-3.2.3/
./configure
make all
cd ./cgi
gcc -g -O2 -DHAVE_CONFIG_H -DNSCGI -o status-json.cgi status-json.c getcgi.o cgiutils.o cgiauth.o macros-cgi.o skiplist.o objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o