Page 1 of 1

How to extract the 7-day availability from NagiosXI

Posted: Wed Oct 30, 2013 11:24 am
by ninety
Hi
In our monitoring station, we need to have the 7-day availability of all monitored hosts displayed on a monitor.

I can get the data on a browser just fine, but I need to "scrape" that data so I can use it in our own HTML.

using lynx or wget either returns "Your session has timed out" or "Your browser doesn't support frames".

Is there a "proper" way I can get the number from command line?

Thanks

Colin

Re: How to extract the 7-day availability from NagiosXI

Posted: Wed Oct 30, 2013 4:49 pm
by abrist
Alright. First, you need the actual url for the availability report. Right click on the menu link under reports for "Availability". Open it in a new tab. Make you modifications to the forms (last week, etc) and click go. The report should update and the url should populate with the get vars. Copy the full url, it should be similar to:

Code: Select all

http://<ip>/nagiosxi/reports/availability.php?host=&service=&reportperiod=thisweek&startdate=&enddate=&reporttimesubmitbutton=Go&host=&hostgroup=&servicegroup=
Now, in order to access it externally, you will need to create a read only XI user.

Once created, get the ticket id for the user --> go to Admin --> Manage Components --> Backend API URL (edit) --> choose your new, read only user from the dropdown. At the end of the forms you will find a username and ticket id in the format of: &username=<username>&ticket=<long ole ticket id>

Append the credentials to the url above. The final url should resemble:

Code: Select all

http://<ip>/nagiosxi/reports/availability.php?host=&service=&reportperiod=thisweek&startdate=&enddate=&reporttimesubmitbutton=Go&host=&hostgroup=&servicegroup=&username=<username>&ticket=<long ole ticket id>

Re: How to extract the 7-day availability from NagiosXI

Posted: Fri Nov 01, 2013 7:16 am
by ninety
Thankyou! That worked PERFECTLY.

Thanks again.