How to change time period of results using backend api

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
Mitchell
Posts: 130
Joined: Thu Jan 05, 2012 2:33 am

How to change time period of results using backend api

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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]
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
Mitchell
Posts: 130
Joined: Thu Jan 05, 2012 2:33 am

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

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
Mitchell
Posts: 130
Joined: Thu Jan 05, 2012 2:33 am

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

Post 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
User avatar
Mitchell
Posts: 130
Joined: Thu Jan 05, 2012 2:33 am

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

Post by Mitchell »

Never mind. I went through php and got the field list and format.

Thanks a lot for the help.

Regards
AShish
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post by sreinhardt »

Awesome! You are welcome.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked