Page 1 of 1

Rest API Service Status Issue

Posted: Thu Jun 02, 2016 2:33 pm
by ciaranrh
Hello,

I'm having an issue accessing the Rest API 'GET objects/servicestatus'. When I try the following command:

Code: Select all

curl -XGET "http://*********/nagiosxi/api/v1/objects/servicestatus?apikey=ahussqm24eq5khp5v8fmivbege75g7onnmjhh9jikbn7re9qmnf8lnj35o7isu9j&pretty=1 > nagios_servicestatus
there is an expected delay and then no output to my file. Curiously when getting data from the Rest API for other sources like objects/hoststatus I get the expected JSON output, it just seems that servicestatus is the only one I can't get output from.

My only guess as to why this would be is the fact that the Nagios server I'm getting this data from has close to 10000 service checks so I might be running into some kind of limitation of the API. Hopefully that's not the case though. Anyone out there run into something similar?

Mod Edit: Please wrap long outputs/inputs in

Code: Select all

 or [icode] tags.[/color]

Re: Rest API Service Status Issue

Posted: Thu Jun 02, 2016 3:07 pm
by rkennedy
You forgot a " at the end, which causes the curl not to post. Try this -

Code: Select all

curl -XGET "http://*********/nagiosxi/api/v1/objects/servicestatus?apikey=ahussqm24eq5khp5v8fmivbege75g7onnmjhh9jikbn7re9qmnf8lnj35o7isu9j&pretty=1" > nagios_servicestatus

Re: Rest API Service Status Issue

Posted: Thu Jun 02, 2016 4:45 pm
by ciaranrh
Thanks,

That was just poor formatting when copying and pasting on my part (my bad), the command I'm running on the server does in fact have the ending " like so:

Code: Select all

curl -XGET "http://*********/nagiosxi/api/v1/objects/servicestatus?apikey=ahussqm24eq5khp5v8fmivbege75g7onnmjhh9jikbn7re9qmnf8lnj35o7isu9j&pretty=1" > nagios_servicestatus

Re: Rest API Service Status Issue

Posted: Thu Jun 02, 2016 5:00 pm
by lmiltchev
Have you tried tweaking the resource limits in the "/etc/php.ini" file (i.e. max_execution_time, memory_limit) ?

Re: Rest API Service Status Issue

Posted: Fri Jun 03, 2016 3:25 pm
by ciaranrh
Thanks for the tip, that got it squared away.

The only change I made was to memory_limit in /etc/php.ini.
The original setting was:
memory_limit = 128M

I tried setting that to 256M and it still wasn't working but bumping that up a little more to 512M did the trick.

Thanks again!

Re: Rest API Service Status Issue

Posted: Mon Jun 06, 2016 10:29 am
by tmcdonald
Glad to hear it! Are we alright to close this thread?

Re: Rest API Service Status Issue

Posted: Mon Jun 06, 2016 10:50 am
by ciaranrh
Yes, please do. Hopefully this will help someone else out there too :)

Thanks,
Ciaran