Page 1 of 1

Report on child relationships

Posted: Mon Apr 22, 2019 10:54 am
by smetzler
Hello,

I was wondering if there is an easy way to get a report of all child relationships (hosts) for a parent host. For example, I want to generate a list of every device (host) connected to a switch. All of the hosts are entered correctly but we have so many, I am trying to simply get a list of all child devices off a single switch. I tried using the Hypermap but we have too many devices.

Thank you,

Shane

Re: Report on child relationships

Posted: Mon Apr 22, 2019 3:04 pm
by cdienger
This should do the trick(replace 'localhost' with the actual parent host):

Code: Select all

echo "select nagios_hosts.display_name from ((nagios_objects INNER JOIN nagios_host_parenthosts ON nagios_objects.object_id=nagios_host_parenthosts.parent_host_object_id)INNER JOIN nagios_hosts ON nagios_host_parenthosts.host_id = nagios_hosts.host_id) where nagios_objects.name1='localhost';" | mysql -uroot -pnagiosxi -Dnagios

Re: Report on child relationships

Posted: Mon Apr 22, 2019 3:20 pm
by smetzler
Thank you for the code and I apologize for the following newbie question, but where do I run that from? The SSH console?

Re: Report on child relationships

Posted: Mon Apr 22, 2019 3:32 pm
by cdienger
Yes, run it from the command line of the XI machine.

Re: Report on child relationships

Posted: Tue Apr 23, 2019 9:27 am
by smetzler
Thank you so much! That worked perfectly!

Re: Report on child relationships

Posted: Tue Apr 23, 2019 9:55 am
by cdienger
Glad to hear!