Page 1 of 1

API call does not return all hosts

Posted: Wed Jul 13, 2016 8:03 am
by amit.ahuja
Hi,

We were having an issue with the backend API in Nagios. One of own tools was making an API call to get all of the hosts that were being monitored in Nagios. But, July 11th, one of the calls returned a JSON only contained part of the hosts.

The API call we were using is "http://<service name>/nagiosxi/api/v1/objects/hoststatus?apikey=uhtbie8r&pretty=1"

error_log only has the following error all over the place.

Code: Select all

[Mon Jul 11 10:08:04 2016] [error] [client xxx] PHP Notice:  Undefined index: pretty in /usr/local/nagiosxi/html/api/includes/utils.inc.php on line 104
Access_log was not able to be uploaded to attachment. But one observation in access_log was that I did not find hoststatus API call in the log.
ssl_error_log and ssl_access_log are empty.

Also, when this API failed, we were running `service nagios restart`. Not sure if this could cause this issue, because we have more than 10 Nagios servers and this is the only one have this issue. And this issue happened twice in this Nagios server.

Does anyone have any idea about this issue?

Thanks.

Re: API call does not return all hosts

Posted: Wed Jul 13, 2016 9:30 am
by rkennedy
Did you follow through with the solution I posted on your previous thread? https://support.nagios.com/forum/viewto ... 11#p189311

I think it may be a PHP limit that is limiting the file from loading. If it's still not working, can you PM over a profile or email one in referencing this thread?

Re: API call does not return all hosts

Posted: Wed Jul 13, 2016 9:43 am
by amit.ahuja
Yes, I read that thread, of course each reply, and talked to haile711. And that was a totally different story. The memory limit is already 256MB because we changed it before. The API call did not time out and it did return something. However, it only returned part of the hosts. It usually works fine, but occasionally did not return the full list.

Re: API call does not return all hosts

Posted: Wed Jul 13, 2016 10:26 am
by rkennedy
Got it - just wanted to make sure in the case that the two of you had not discussed it.

Can you PM over a profile, or email one in for us to look at? This should have a bit more information that will help us.