List associations for hosts, services and groups
List associations for hosts, services and groups
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.
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
How do you want this data organized? By *group? By host? etc?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: List associations for hosts, services and groups
Can you be a bit more specific? What format would this list take? Would it be text-based or visual? CSV?
Former Nagios employee
Re: List associations for hosts, services and groups
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!
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
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
You can use the json cgi to retrieve a detailed list of hosts in a specific <hostgroup>:
You can convert this json to csv using your favorite converter.
Code: Select all
http://<ip>/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true&hostgroup=<hostgroup>Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: List associations for hosts, services and groups
Interesting. Thank you for the idea. I am going to try this.abrist wrote:You can use the json cgi to retrieve a detailed list of hosts in a specific <hostgroup>:You can convert this json to csv using your favorite converter.Code: Select all
http://<ip>/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true&hostgroup=<hostgroup>
Re: List associations for hosts, services and groups
SavaSC, let us know if that worked for you and if you have any additional questions.
Re: List associations for hosts, services and groups
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.abrist wrote:You can use the json cgi to retrieve a detailed list of hosts in a specific <hostgroup>:You can convert this json to csv using your favorite converter.Code: Select all
http://<ip>/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true&hostgroup=<hostgroup>
Re: List associations for hosts, services and groups
Here is Andy's document on the JSON CGI in Nagios.
http://labs.nagios.com/2014/06/19/explo ... #more-1897
http://labs.nagios.com/2014/06/19/explo ... #more-1897
Be sure to check out our Knowledgebase for helpful articles and solutions!