Hello,
I am trying to utilize the REST API to get usage stats.
I have run into a problem specifically for the statushistory call, whenever I try the example from the objects reference page with only a starttime parameter I get an empty json as response (No errors or any wearnings). The result is supposed to be the data until now.
Now, if I add an endtime parameter with a date prior to 4-12-2018 18:21:00 (EET - I add it as the equivalent of that datetime in seconds) I get a response with the data as expected. I pretty sure the first time I tried the /nagiosxi/help/api-object-reference.php#building-queries examples I could sometimes get the result with just the starttime parameter. Wierdest thing is, I think the date I mentioned might be the first time I used the examples.
The hostavailability call works fine - I am guessing other REST components work fine as well.
Any ideas why this could be happening or actions I can do to overcome this issue will be appreciated. I am actually accessing the API with Python, but have tested with my browser, and my code, and curl and the result is the same.
My clients expect a weekly report so I am in need to get a workaround as sooner as possible.
George Panou
Algosystems SA
Nagios REST API issue
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Nagios REST API issue
@gpanou, What timestamp for the start time did you use? Was it some time in April this year? -> (4-12-2018)
This means the API report was supposed to return 8 months worth of data(since when you don't specify the end time Nagios defaults to "now" value). That kind of report may be too large for the API.
This means the API report was supposed to return 8 months worth of data(since when you don't specify the end time Nagios defaults to "now" value). That kind of report may be too large for the API.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios REST API issue
Thanks for the reply, the date is 4 Dec 2018 (European format). I am testing it with the browser examples as well so even the now timestamp in seconds doesn't work.
For example:
http://x.x.x.x/nagiosxi/api/v1/objects/ ... lOTJqNlm8V
For example:
http://x.x.x.x/nagiosxi/api/v1/objects/ ... lOTJqNlm8V
Re: Nagios REST API issue
Since I am working on a production environment, is there a single Nagios service related to the REST API I could try restarting?
Re: Nagios REST API issue
In any case my API call requests less than a week of data
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Nagios REST API issue
@gpanou, I see. Can you open the XI web interface, go to Reports and generate a state history report from Tue, 04 Dec 2018 till now and let me know if you see any data in the report?
Could you also send in your system profile?
Could you also send in your system profile?
After you send the profile please post something in this thread to bring it back up in the support queue.To send us your system profile. Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and send it to me in a personal message.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios REST API issue
The state history report is 29 pages of data that seems OK, there is data since 4 Dec until Now.npolovenko wrote:@gpanou, I see. Can you open the XI web interface, go to Reports and generate a state history report from Tue, 04 Dec 2018 till now and let me know if you see any data in the report?
Could you also send in your system profile?After you send the profile please post something in this thread to bring it back up in the support queue.To send us your system profile. Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and send it to me in a personal message.
I sent you the profile via pm.
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Nagios REST API issue
@gpanou, I see some indications of crashed PHP processes because there is no sufficient memory.
Please open the /etc/php.ini file and increase the "memory_limit" to 512M.
Then restart apache with service httpd restart and try your API command one more time.
Please open the /etc/php.ini file and increase the "memory_limit" to 512M.
Then restart apache with service httpd restart and try your API command one more time.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios REST API issue
That did the trick!
Thanks a lot for your help and for the quick response.
Thanks a lot for your help and for the quick response.
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Nagios REST API issue
@gpanou , You're welcome!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.