API statehistory timeframe

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

API statehistory timeframe

Post by optionstechnology »

When using the statehistory API command /nagiosxi/api/v1/objects/statehistory it seems to go back 24 hours by default - is it possible to tell it to look further back?

There doesn't appear to be any additional arguments listed in the help...
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: API statehistory timeframe

Post by pbroste »

Hello @optionstechnology

Thanks for reaching out, there is an option to set 'starttime' by adjusting the date code to the date you want to start from.

Example:
starttime <timestamp> (Default: -24 hours) objects/statehistory?starttime=1644273476 - Displays the last week of data until now.
The api example:

Code: Select all

curl -XGET "https://yourhostaddresshere/nagiosxi/api/v1/objects/statehistory?starttime=1644273476&apikey=yourapikeyhere&pretty=1"
Thanks,
Perry
Locked