Page 1 of 1
Nagios report with hostname and ips
Posted: Mon Apr 03, 2017 11:14 pm
by sunnynani4849
Hi Team,
We are using Nagios Xi in our environment, is there anyway to pull the report which includes the hostnames, ip address , services monitored on each hosts with there thresholds from the NAGIOS console (or) is there any way we can run the mysql query to get this reported.
Re: Nagios report with hostname and ips
Posted: Tue Apr 04, 2017 11:42 am
by mcapra
You could use the REST API added as of Nagios XI 5. Usage can be found in the "Help" section of your Nagios XI GUI.
Here's a sample API call to get all the defined hosts in Nagios XI (this will not work on your machine; it's an example):
Code: Select all
curl -XGET "http://192.168.67.1/nagiosxi/api/v1/objects/host?apikey=KR2LLsBuhmmFnS4dbmeURW0culVlv39vbbBVW8pet69bXdH8CUiK8DcFX7gMpohD&pretty=1"
Similarly, there is also an endpoint to get all the services (this will not work on your machine; it's an example):
Code: Select all
curl -XGET "http://192.168.67.1/nagiosxi/api/v1/objects/host?apikey=KR2LLsBuhmmFnS4dbmeURW0culVlv39vbbBVW8pet69bXdH8CUiK8DcFX7gMpohD&pretty=1"
You're sort of on your own for joining the hosts+services together though. One way to do it would be to first get a list of hosts, then get a list of all the services under that host using a limited query. Limited queries are explained in the documentation I mentioned previously.