Page 1 of 2
Core 4.0.8 jsonquery.php 404 not found (Solved!)
Posted: Tue May 19, 2015 7:43 pm
by mobrien03
When executing https://{hostname}/nagios/jsonquery.html, the resulting Query Generator screen is displayed. Selecting any of the 3 cgi's, then "Send Query" result in a HTTP 404 not found for jsonquery.php. I've searched the installation tree to no avail. I've searched this forum, and Google in general and haven't received any useful hits for this issue. I suspect it's some compile option not present during build, or possibly a package missing. Any ideas on how to complete the installation so this file is included? Help is much appreciated. Thanks!
Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Wed May 20, 2015 9:35 am
by jolson
Do you have the following files installed?
Code: Select all
/usr/local/nagios/share/js/jsonquery.js
/usr/local/nagios/share/js/jquery-1.7.1.min.js
/usr/local/nagios/share/jsonquery.html
/usr/local/nagios/share/stylesheets/jsonquery.css
If not, I could try sending you mine - see attached.
Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Wed May 20, 2015 9:37 am
by abrist
This is odd. We do not include a jsonquery.php in the source. The send query button should query the cgis, not jsonquery.php.
Could you PM me a copy of your jsonquery.html?
Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Wed May 20, 2015 11:58 am
by mobrien03
Appreciate the replies
@jolson: Yes, I have those files:
$ pwd;ls -1 js/j*.js js*.html stylesheets/js*.css
/usr/local/nagios/share
js/jquery-1.7.1.min.js
js/jsonquery.js
jsonquery.html
stylesheets/jsonquery.css
$
@abrist: I will PM you my copy of jsonquery.html shortly.
Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Wed May 20, 2015 1:37 pm
by abrist
Odd, this should just work. I reproduced the issue one time on a fresh build, and then it started working.
Are the cgi permissions correct?
Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Wed May 20, 2015 2:16 pm
by mobrien03
$ ls -la /usr/local/nagios/sbin
total 4208
drwxrwxr-x. 2 nagios nagios 4096 Sep 12 2014 .
drwxr-xr-x. 9 root root 4096 May 27 2014 ..
-rwxr-xr-x. 1 nagios nagios 307936 Sep 12 2014 archivejson.cgi
-rwxr-xr-x. 1 nagios nagios 287944 Sep 12 2014 avail.cgi
-rwxr-xr-x. 1 nagios nagios 288424 Sep 12 2014 cmd.cgi
-rwxr-xr-x. 1 nagios nagios 259240 Sep 12 2014 config.cgi
-rwxr-xr-x. 1 nagios nagios 300200 Sep 12 2014 extinfo.cgi
-rwxr-xr-x. 1 nagios nagios 234664 Sep 12 2014 history.cgi
-rwxr-xr-x. 1 nagios nagios 230824 Sep 12 2014 notifications.cgi
-rwxr-xr-x. 1 nagios nagios 308704 Sep 12 2014 objectjson.cgi
-rwxr-xr-x. 1 nagios nagios 226440 Sep 12 2014 outages.cgi
-rwxr-xr-x. 1 nagios nagios 230824 Sep 12 2014 showlog.cgi
-rwxr-xr-x. 1 nagios nagios 300232 Sep 12 2014 status.cgi
-rwxr-xr-x. 1 nagios nagios 306560 Sep 12 2014 statusjson.cgi
-rwxr-xr-x. 1 nagios nagios 246984 Sep 12 2014 statuswml.cgi
-rwxr-xr-x. 1 nagios nagios 230728 Sep 12 2014 statuswrl.cgi
-rwxr-xr-x. 1 nagios nagios 255208 Sep 12 2014 summary.cgi
-rwxr-xr-x. 1 nagios nagios 242920 Sep 12 2014 tac.cgi
$
Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Wed May 20, 2015 2:35 pm
by mobrien03
After selecting the "Send Query" button for "Status JSON CGI", the URL/URI becomes: https://{hostname}/nagios/
jsonquery.php?cginame=statusjson.cgi
From what I understand, the component of the URI called jsonquery.php is a module being called, and everything to the right of the ? are name/value pairs of arguments to pass to the module.
I simply don't have a file called jsonquery.php on this system. Unless some other magic is happening that I'm not aware of, I just seem to be missing a critical file...

Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Wed May 20, 2015 7:34 pm
by Box293
I suggest recompiling core 4.0.8. I've played with the JSON CGI's a while back and this was done on a fresh compile of Core 4.0.8 and I didn't need to do anything special.
Re: Core 4.0.8 jsonquery.php 404 not found (Solved!)
Posted: Thu May 21, 2015 12:41 pm
by mobrien03
On a Test system, I re-compiled and re-installed 4.0.8. Still no luck - same issue. Back on the production system (where no changes have occurred), I was attempting another test of jsonquery.html, and had just selected the "Status JSON CGI" option from the list, but then got distracted by a phone call. I came back a short while later to find that the screen had filled in with a query field (listbox), some format options (check boxes) and a Date format field! I had not seen this before! I was able to select various options and produce output -- as expected!
I went back to the QA system, and tried there as well, but now providing a wait period (15 - 20 seconds or so) after selecting "Status JSON CGI", and sure enough, the various new Option fields began to show up!
The problem was simply not allowing enough time for the application to go gather the object data for the listbox drop-downs and other Option fields! However, I should point out that during the entire time, the "SEND QUERY" button was "live", so there was nothing stopping me from selecting "SEND QUERY" prior to waiting (or even knowing to look) for the background processing to fill in the listbox data -- of course, I've never used this utility before, so I didn't know what the screen should look like. Now I know.
If you find yourself getting the error of "jsonquery.php" 404 not found, this indicates you've hit "SEND QUERY" before the application was ready -- basically, just wait and allow the new Option selection fields to appear and for the list boxes to fill in.
Suggestion for Development Team: Gray out the "SEND QUERY" button until the background object processing, and list boxes fill in, and the user has at least made some selection criteria for the subsequent query.
Re: Core 4.0.8 jsonquery.php 404 not found
Posted: Thu May 21, 2015 12:45 pm
by abrist
Awesome, I will pass this on to Eric. You could also submit an issue on github to get this bug fixed sooner:
https://github.com/NagiosEnterprises/nagioscore