Page 1 of 1

Configuration Report for Host/Services

Posted: Tue Sep 25, 2018 10:17 am
by MikeMAN987
Hello,

In our environment, we have thousands of checks that IT admins are constantly looking to tune. Often times I will get a request to generate a list of all alerts/checks for a specific host. Right now this is a very manual process between looking at hostgroups->template inheritance-> seeing if there are contacts on the template, seeing which thresholds are set etc. Is there a way to script/run this to export a "as running" configuration for specific hosts and their services? I know there is an inheritance model and we use that heavily but can I query, or from command line run a command like "give me host1" and it generates the configuration for itself and its services as Nagios XI is interpreting it?

Regards,
Mike

Re: Configuration Report for Host/Services

Posted: Tue Sep 25, 2018 11:15 am
by jforcier
Try accessing Nagios Core by using this link, where xxx.xxx.xxx.xxx if the IP of the XI server:

Code: Select all

http://xxx.xxx.xxx.xxx/nagios/
Once you are logged in, click on 'Configuration' on the left hand menu under 'System'. This will provide a table of all the hosts/services and their configurations. Is this what you were thinking of?

Re: Configuration Report for Host/Services

Posted: Thu Sep 27, 2018 3:12 pm
by MikeMAN987
Thanks for this. Never occurred to me to use the existing underlying core system to also help pull data. I'm not sure this is showing what "nagios" see's however after it inherits all its templates?

Re: Configuration Report for Host/Services

Posted: Fri Sep 28, 2018 5:18 am
by optionstechnology
have you considered using the API?

Code: Select all

https://NAGSERVER/nagiosxi/api/v1/objects/servicestatus?host_name=SERVERNAME&apikey=APIKEY&pretty=1
That should get you a JSON of all services running for that host


You could also consider using Thruk - https://www.thruk.org/

Its a great front end for user friendly viewing of configs-
Thrukconfigviewer.PNG

Re: Configuration Report for Host/Services

Posted: Fri Sep 28, 2018 9:33 am
by lmiltchev
Thanks @optionstechnology!

@MikeMAN987, yes you coud use the REST API in Nagios XI. You could also use the JSON Query Generator in Nagios Core.

Example URL:
[codehttp://<server ip>/nagios/jsonquery.html[/code]