Core 4.0.8 jsonquery.php 404 not found (Solved!)

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
mobrien03
Posts: 8
Joined: Tue May 19, 2015 7:25 pm

Core 4.0.8 jsonquery.php 404 not found (Solved!)

Post 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!
Last edited by mobrien03 on Thu May 21, 2015 12:45 pm, edited 1 time in total.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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.
Attachments
jquery stuff.zip
(35.53 KiB) Downloaded 168 times
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
mobrien03
Posts: 8
Joined: Tue May 19, 2015 7:25 pm

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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?

Code: Select all

ls -la /usr/local/nagios/sbin
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
mobrien03
Posts: 8
Joined: Tue May 19, 2015 7:25 pm

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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
$
mobrien03
Posts: 8
Joined: Tue May 19, 2015 7:25 pm

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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... :?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mobrien03
Posts: 8
Joined: Tue May 19, 2015 7:25 pm

Re: Core 4.0.8 jsonquery.php 404 not found (Solved!)

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Core 4.0.8 jsonquery.php 404 not found

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked