I am attempting to pull in the hoststatus via API and get hostnames of servers where the active_checks_enabled=0.
I used to be able to run the following:
curl -XGET -k -s https://SERVER/nagiosxi/api/v1/objects/hoststatus?apikey=KEY&active_checks_enabled=0&pretty=1 | grep \"host_name\":
Now, I just get an unformed response for the curl command. Did something change in how Nagios responds to a curl?
Running RHEL 7.8 VM's and Nagios XI 5.7.3
API not returning pretty JSON
Re: API not returning pretty JSON
I'm getting the pretty output. Just a quick thing I noticed, though, your command posted here doesn't have quotes around it. When I copied and pasted into my environment, replaced the XI IP and API key, I did get big, ugly output. Can you confirm that the command you're running looks more like this?
Code: Select all
curl -XGET -k -s "https://SERVER/nagiosxi/api/v1/objects/hoststatus?apikey=KEY&active_checks_enabled=0&pretty=1" | grep \"host_name\":As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: API not returning pretty JSON
Thanks, that worked.