Resolved | JSON Query Generator

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Resolved | JSON Query Generator

Post by wneville »

Hello,

I am trying to pull out free variables for enrichment of a Grafana dashboard. From grafana, i am querying the statusjson.cgi on a servicegroup to pull monitor status. My goal is to use another query to pull back free variables and join the results on servicename.

I see that when i target the objectjson.cgi on a specific host and service, the free variables are returned. However, when i try to query the objectjson.cgi for "servicelist" or "servicegrouplist" I get a 504 error. Is there anything I can do to fix this? Is there another way to pull back the free variables on a given service?

Thank you!
gwesterman
Posts: 269
Joined: Wed Aug 23, 2023 11:29 am

Re: JSON Query Generator

Post by gwesterman »

Hi @wneville,

Try going to http://<your nagios server>/nagios/jsonquery.html and generating your query there. Let us know if that query works or if it also 504s.

You should also be able to use the API (the docs are found in XI in the Help section) for what you are looking for.

If you have any additional questions, please reach out.

Thank you!
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Re: JSON Query Generator

Post by wneville »

Thanks for your response! I started on the jsonquery.html page but nothing happened when i pressed 'send query' which prompted me to go somewhere where i could see if the query was being sent/what error would be given.

If possible, I would like to run these from the same Grafana data source (nagios json cgi). Is it possible to get the free variables for all the services in a servicegroup (using any of the objectjson queries)? Then I can create a join/union on the servicename to match up the two queries.

In other places I have used wildcards, but I can't seem to drill down to custom variables using wildcards on the 'service' query in objectjson.cgi



If I can resolve the 504 errors I can investigate what all is available, any ideas on how I can resolve that?
gwesterman
Posts: 269
Joined: Wed Aug 23, 2023 11:29 am

Re: JSON Query Generator

Post by gwesterman »

Hi @wneville,

This thread may be useful. Another user was getting a timeout accessing the archivejson.cgi. Try some of the steps outlined in the thread, namely verifying file permissions, checking for selinux, and potentially increasing the apache timeout.

Let us know what you find.

Thank you!
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Re: JSON Query Generator

Post by wneville »

Thanks for passing that along, with that I was able to resolve the issue!

When I pressed "send query" in the json query generator, a message appeared in /var/log/httpd/ssl_error_log:

Code: Select all

[Tue Oct 15 10:43:27.107868 2024] [cgid:warn] [pid 3325225:tid 139846584612608] [client [IP]] AH01220: Timeout waiting for output from CGI script /usr/local/nagios/sbin/objectjson.cgi, referer: https://nagiossrv1/nagios/jsonquery.html
[Tue Oct 15 10:43:27.107922 2024] [cgid:error] [pid 3325225:tid 139846584612608] [client [IP]] Script timed out before returning headers: objectjson.cgi, referer: https://nagiossrv1/nagios/jsonquery.html
I increased my Timeout in httpd.conf from 10 to 30 and now the query can complete successfully. Thanks so much!
gwesterman
Posts: 269
Joined: Wed Aug 23, 2023 11:29 am

Re: Resolved | JSON Query Generator

Post by gwesterman »

I'm glad I could help!

I'm going to lock this thread to keep the forum organized.

Please reach out if you encounter any other issues!
Locked