A hostgroup of all devices, except for a specific hostgroup


#1

Hello all,

Made a list of hostgroups that are for both of my remote sites. So all of the hosts in remotesite1 and remotesite2 are in their own hostgroup definiton. This works fine.

I would like a hostgroup that covers all hosts, EXCEPT these that are in the two defined hostgroups. Basically those hosts that are “here” and not in remotesite1 or remotesite2 (which are both small). This would allow all hosts to be represented in one of these three hostgroups.

And why? Using a NagVis map of the three sites, I have remotesite1 and remotesite2 listed, and would like “here” represented also.

I can specifiy * for all devices, and then use the ! to exclude a host. This works, but is not what I want.

This is what I wanted to do, but this fails. You cannot use a hostgroup as member:

define hostgroup{ hostgroup_name All_Devices_Here alias Devices Here members *,!remotesite1,!remotesite2 }
Suggestions? How can I do this?

Thank you,
TalkingToes


#2

good question, but no idea on this one … sorry :confused:


#3

Don’t know whether this would work or not (i.e. I haven’t tested it) and assuming that you’ve defined your hostgroup members through the hostgroup object ‘member’ variable rather than including them through the host object’s ‘hostgroups’’ variable, this would take some amount of reconfiguration…
Any road up, the idea is, rather than specify ‘members’ in hostgroup objects, to specify “hostgroups All_Devices_Here” in a host object template and then ‘use’ this template in all of your host objects. Then, for each individual host object, specify “hostgroups remotesite1” or “hostgroups remotesite2” as appropriate for those hosts that are not ‘here’ and this will (should, might) overwrite the template entry, and thus leave you with the remainder of your hosts that you don’t change in the, if you like, default hostgroup “All_Devices_Here”.
Not a great solution but it might do the job, though it’s certainly not really practical for hundreds of hosts… the ability to negate a hostgroup would be a much more useful addition IMHO

HTH

/S