Page 1 of 1
API statehistory timeframe
Posted: Mon Feb 14, 2022 5:58 am
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...
Re: API statehistory timeframe
Posted: Mon Feb 14, 2022 5:48 pm
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