List associations for hosts, services and groups

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

List associations for hosts, services and groups

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: List associations for hosts, services and groups

Post by abrist »

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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: List associations for hosts, services and groups

Post by tmcdonald »

Can you be a bit more specific? What format would this list take? Would it be text-based or visual? CSV?
Former Nagios employee
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: List associations for hosts, services and groups

Post 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!
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: List associations for hosts, services and groups

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: List associations for hosts, services and groups

Post 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.
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.
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: List associations for hosts, services and groups

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: List associations for hosts, services and groups

Post by ssax »

SavaSC, let us know if that worked for you and if you have any additional questions.
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: List associations for hosts, services and groups

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: List associations for hosts, services and groups

Post by tgriep »

Here is Andy's document on the JSON CGI in Nagios.
http://labs.nagios.com/2014/06/19/explo ... #more-1897
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked