Page 1 of 2
List associations for hosts, services and groups
Posted: Wed Feb 25, 2015 12:04 pm
by SavaSC
Hello all.
I am trying to generate a list of all of the associations between our hosts, services and groups. I see there are macros that can do this (IE. $HOSTGROUPMEMBERS$) but I'm having trouble implementing them. Any suggestions would be greatly appreciated.
Re: List associations for hosts, services and groups
Posted: Wed Feb 25, 2015 12:07 pm
by abrist
How do you want this data organized? By *group? By host? etc?
Re: List associations for hosts, services and groups
Posted: Wed Feb 25, 2015 12:07 pm
by tmcdonald
Can you be a bit more specific? What format would this list take? Would it be text-based or visual? CSV?
Re: List associations for hosts, services and groups
Posted: Wed Feb 25, 2015 12:31 pm
by SavaSC
Thank you for the quick responses. To answer in the order they were asked:
1) I was under the impression that the macros would give me data relevant to their function. IE: the $HOSTGROUPMEMEBERS$ would organize by the Host Group. I really need to look at at each (hosts, services, host groups, service groups). Our instance of NagiosXI is a bit.... wandering. I'm trying to clean it up.
2) Any kind of output would be OK. I guess the best would be a .css file so I could take it off-line and play with it.
Thank you!
Re: List associations for hosts, services and groups
Posted: Wed Feb 25, 2015 1:20 pm
by SavaSC
Perhaps I'm thinking of this the wrong way. Is there a way to export the Host Group Status Grid view to a CSV file? That will give me everything I need. I would just have to massage the data to see it in a comfortable way.
Re: List associations for hosts, services and groups
Posted: Wed Feb 25, 2015 2:56 pm
by abrist
You can use the json cgi to retrieve a detailed list of hosts in a specific <hostgroup>:
Code: Select all
http://<ip>/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true&hostgroup=<hostgroup>
You can convert this json to csv using your favorite converter.
Re: List associations for hosts, services and groups
Posted: Thu Feb 26, 2015 8:54 am
by SavaSC
abrist wrote:You can use the json cgi to retrieve a detailed list of hosts in a specific <hostgroup>:
Code: Select all
http://<ip>/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true&hostgroup=<hostgroup>
You can convert this json to csv using your favorite converter.
Interesting. Thank you for the idea. I am going to try this.
Re: List associations for hosts, services and groups
Posted: Thu Feb 26, 2015 10:28 am
by ssax
SavaSC, let us know if that worked for you and if you have any additional questions.
Re: List associations for hosts, services and groups
Posted: Thu Feb 26, 2015 1:40 pm
by SavaSC
abrist wrote:You can use the json cgi to retrieve a detailed list of hosts in a specific <hostgroup>:
Code: Select all
http://<ip>/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true&hostgroup=<hostgroup>
You can convert this json to csv using your favorite converter.
This seems to be an extraordinarily useful tool. Is there a help document for objectjson.cgi? I did a quick search through the Nagios online library but couldn't find anything on it. I'm about to start improvising and see if I can get it to feed me what I am looking for.
Re: List associations for hosts, services and groups
Posted: Thu Feb 26, 2015 3:33 pm
by tgriep