Hello,
We are in the process of moving our hosts (1300+) into various hostgroups. I am now at a point where I am trying to find the outliers/orphans; hosts still not in any group.
Is there an easy way to get this shown? I don't see anything immediate when looking.
I am running Nagios XI 5.2.3 on RHEL6 latest.
Thanks!
List hosts that don't belong to any hostgroup.
Re: List hosts that don't belong to any hostgroup.
There are at least 2 ways to add a host to a hostgroup, add the hostgroup to the host, or add the host to the hostgroup. I do the latter, so it looks like it might be a pain w/o writing a script or oneliner to create a list. Or not :)
grep members /usr/local/nagios/etc/hostgroups.cfg | sed -e 's/members//g' | tr -d '[:blank:]' | tr , '\n' | sort -u
If you put the hostgroup in the host, grep hostgroup /usr/local/nagios/etc/hosts/*.cfg should print a list of host config files that represent the hosts in hostgroups.
Get a list of hosts: ls -1 /usr/local/nagios/etc/hosts/ | sed -e 's/\.cfg//g'
Redirect into files, diff and grep...
grep members /usr/local/nagios/etc/hostgroups.cfg | sed -e 's/members//g' | tr -d '[:blank:]' | tr , '\n' | sort -u
If you put the hostgroup in the host, grep hostgroup /usr/local/nagios/etc/hosts/*.cfg should print a list of host config files that represent the hosts in hostgroups.
Get a list of hosts: ls -1 /usr/local/nagios/etc/hosts/ | sed -e 's/\.cfg//g'
Redirect into files, diff and grep...
Re: List hosts that don't belong to any hostgroup.
Yep, I figured it was going to turn out that way. I figured there would be a nice "shiny" report for management types too. Thanks and consider this resolved (unless someone *does* know of a special shiny report).
Robert
Robert
gormank wrote:There are at least 2 ways to add a host to a hostgroup, add the hostgroup to the host, or add the host to the hostgroup. I do the latter, so it looks like it might be a pain w/o writing a script or oneliner to create a list. Or not
grep members /usr/local/nagios/etc/hostgroups.cfg | sed -e s/members//g | tr -d '[:blank:]' | tr , "\n" | sort -u
If you put the hostgroup in the host, grep hostgroup /usr/local/nagios/etc/hosts/*.cfg should print a list of host config files that represent the hosts in hostgroups.
Get a list of hosts: ls -1 /usr/local/nagios/etc/hosts/ | sed -e s/\.cfg//g
Redirect into files, diff and grep...
Re: List hosts that don't belong to any hostgroup.
Pres-Gas, we don't have such a report included by default in XI, so gormank's suggestion would be a way to go. You are welcome to file a feature request on our public tracker here:
http://tracker.nagios.com
I am locking this topic now. Thank you!
http://tracker.nagios.com
I am locking this topic now. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!