Page 1 of 1

How to change time period of results using backend api

Posted: Mon Jul 01, 2013 6:36 pm
by Mitchell
Hello,

I am using
http://**/nagiosxi/backend/?cmd=getstatehistory
to pull unique problem events. Could you please provide an example of how can I change the time period of results returned. the default seems last 24 hrs.

Thanks
Ashish

Re: How to change time period of results using backend api

Posted: Tue Jul 02, 2013 9:59 am
by sreinhardt
You should be able to with additional parameters to your uri. For simplicities sake, I would highly suggest running the query you want through a proxy like burp suite or owasp zap to get the exact string that is submitted without too much trouble. Otherwise here is a pretty complete list, and what a completed request looks like

"http://192.168.168.132/nagiosxi/reports ... records=25"

host=
service=
search=Search...
reportperiod=[report time periods (not same as nagios TP)]
startdate=[yyyy-mm-dd]
enddate=[yyyy-mm-dd]
reporttimesubmitbutton=Go
hostgroup=
servicegroup=
statetype=[hard\soft]
page=[integer]
records=[integer]

Re: How to change time period of results using backend api

Posted: Tue Jul 02, 2013 2:08 pm
by Mitchell
Thanks for the information.

I need to use this information with backend api and not 'statehistory.php'.
It seems 'statehistory.php' is ultimately using backend api after some param manipulation. It will be helpful to see the ultimate format of items I can use with backend api.

Thanks
Ashish

Re: How to change time period of results using backend api

Posted: Tue Jul 02, 2013 2:15 pm
by sreinhardt
Out of curiosity is there a reason that you cannot call the php page and must use the backend call? Using the backend token, any page within XI can be called. Otherwise it will require a fair amount more digging before I would have an answer for you.

Re: How to change time period of results using backend api

Posted: Tue Jul 02, 2013 2:24 pm
by Mitchell
Need to automate this using Excel and then auto export to our reporting servers.

In excel, I will be able to use many pre-defined format which will populate as soon as I refresh the data.


Regards
Ashish

Re: How to change time period of results using backend api

Posted: Tue Jul 02, 2013 2:48 pm
by Mitchell
Never mind. I went through php and got the field list and format.

Thanks a lot for the help.

Regards
AShish

Re: How to change time period of results using backend api

Posted: Tue Jul 02, 2013 3:06 pm
by sreinhardt
Awesome! You are welcome.