Rest API Service Status Issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ciaranrh
Posts: 37
Joined: Thu Jul 09, 2015 3:54 pm

Rest API Service Status Issue

Post 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]
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Rest API Service Status Issue

Post 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
Former Nagios Employee
ciaranrh
Posts: 37
Joined: Thu Jul 09, 2015 3:54 pm

Re: Rest API Service Status Issue

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Rest API Service Status Issue

Post by lmiltchev »

Have you tried tweaking the resource limits in the "/etc/php.ini" file (i.e. max_execution_time, memory_limit) ?
Be sure to check out our Knowledgebase for helpful articles and solutions!
ciaranrh
Posts: 37
Joined: Thu Jul 09, 2015 3:54 pm

Re: Rest API Service Status Issue

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Rest API Service Status Issue

Post by tmcdonald »

Glad to hear it! Are we alright to close this thread?
Former Nagios employee
ciaranrh
Posts: 37
Joined: Thu Jul 09, 2015 3:54 pm

Re: Rest API Service Status Issue

Post by ciaranrh »

Yes, please do. Hopefully this will help someone else out there too :)

Thanks,
Ciaran
Locked