REST API query for year-long data

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dsynapalos
Posts: 23
Joined: Tue Jun 25, 2019 2:26 am

REST API query for year-long data

Post by dsynapalos »

Hello and good day,

when we query the Nagios XI Rest api for the statehistory of past year's January of 2019 we receive over 10k logs.

query url:

Code: Select all

https://<host>/nagiosxi/api/v1/objects/statehistory?apikey=<key>&starttime=1546300800&endtime=1548892800
querying the logentries tab for the same period yields NO results.

query url:

Code: Select all

https://<host>/nagiosxi/api/v1/objects/logentries?apikey=<key>&starttime=1571702400&endtime=1572480000
We can see that the .rrd files contain data for the whole year.

Does the fault lie within the query url or is there a hardcoded limit to the length of the data storage?

What would be the correct urls for us to query in order to get the statehistory and logentry data of the whole year (2019)?

Regards, Dimitrios Synapalos
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: REST API query for year-long data

Post by scottwilkerson »

It depends on how log you have the data retention set to, this can be found in
Admin -> Performance Settings -> Databases Tab -> Max Log Entries Age

Your query ends "Thursday, October 31, 2019 12:00:00 AM" so you need to be able to go back at least that far
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
dsynapalos
Posts: 23
Joined: Tue Jun 25, 2019 2:26 am

Re: REST API query for year-long data

Post by dsynapalos »

Thank you for your answer, it was very clarifying.

What we would like to do is access the data Nagios is using to create the Alerts by (Hour of the Day, Day of the Week, Month).
The Reports->Top Alert Histogram page allows us to select Last Year as a valid period so there have to be a relevant data store for the mentioned period.
Is said data store available for querying through the API?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: REST API query for year-long data

Post by scottwilkerson »

There isn't a method that builds this for you, but you can get these from the objects/statehistory API
using the starttime and endtime limiters as described in
Help -> Objects Reference -> Building Limited Queries
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked