Hi,
We were having some issue with the backend API in Nagios. One of own tools was using API call to get all of the hosts that were being monitored in Nagios. But, yesterday, one of the calls returned a JSON only contained part of the hosts. Does anyone have a solution for this issue?
Thanks.
API call does not return all hosts.
Re: API call does not return all hosts.
Can you show us the call you were making as well as the output? Also, what version of XI are you running?
Former Nagios Employee
Re: API call does not return all hosts.
rkennedy,
this is the call im making that have the same issue.
[url]http://nagios_server/nagiosxi/api/v1/objects/servicestatus?apikey=apikey&pretty=1[/url].
The page come up blank, but any other calls work.
Thanks
this is the call im making that have the same issue.
[url]http://nagios_server/nagiosxi/api/v1/objects/servicestatus?apikey=apikey&pretty=1[/url].
The page come up blank, but any other calls work.
Thanks
Re: API call does not return all hosts.
Can you post your HTTP log files for us to look at?
Additionally, what version of XI are you running?
Code: Select all
/var/log/httpd/error_log
/var/log/httpd/ssl_error_log
/var/log/httpd/access_log
/var/log/httpd/ssl_access_log
Former Nagios Employee
Re: API call does not return all hosts.
rkennedy,
current version: 5.2.3
I've attached the access_log and error_log but the other 2 it's empty
Thxs
current version: 5.2.3
I've attached the access_log and error_log but the other 2 it's empty
Thxs
You do not have the required permissions to view the files attached to this post.
Re: API call does not return all hosts.
This error seems to be all over -
Which I'm guessing is why you're seeing a blank page. Try changing your memory_limit setting from 128M to 256M in /etc/php.ini. Here is how mine currently looks -
After changing the memory_limit = 128M to memory_limit = 256M run a service httpd restart, and try to open the API once again.
Code: Select all
[Tue Jul 12 02:22:07 2016] [error] [client 11.48.169.63] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 354 bytes) in /usr/local/nagiosxi/html/backend/includes/xml2json.php on line 243
Code: Select all
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
Former Nagios Employee
Re: API call does not return all hosts.
rkennedy,
That did it, thanks for helping!!!
That did it, thanks for helping!!!
Re: API call does not return all hosts.
Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: API call does not return all hosts.
mcapra,
Please do, thxs!
Please do, thxs!