Page 1 of 2

Exclude hostgroup_members

Posted: Tue Oct 01, 2013 8:52 am
by jessegto
Hello everyone,
I am running Nagios Core 3.5 and it appears excluding hostgroup members within hostgroups is not allowed. Here is an example definition of what I am trying to do:

Code: Select all

define hostgroup{
        hostgroup_name          hg-test
        alias                   HG Test
        hostgroup_members       hg1,hg2,!hg3
        }
Whenever I verify the config, I will get this message:
Error: Could not find member group '!hg3' specified in hostgroup

I haven't seen a fix for this when looking through the changelogs, although I haven't tried 4.0 yet to verify.

Does anyone know if there is a patch I could use for Nagios? Is Nagios aware of this bug / missing feature?

Re: Exclude hostgroup_members

Posted: Tue Oct 01, 2013 11:28 am
by tmcdonald
If you are trying to exclude a hostgroup, just don't include it in the list. The object definitions function best as whitelists instead of blacklists.

This page is the Nagios Core Object Definitions page and is quite handy for manually editing config files.

Re: Exclude hostgroup_members

Posted: Tue Oct 01, 2013 2:20 pm
by DeanM
I have only needed to exclude if I have wild card (*) included in front of my selections.

Re: Exclude hostgroup_members

Posted: Tue Oct 01, 2013 7:28 pm
by jessegto
There is a reason I need to exclude a third host group. The third host group members are also part of the first two host groups.

Re: Exclude hostgroup_members

Posted: Wed Oct 02, 2013 9:19 am
by scottwilkerson
you can exclude hosts but not exclude hostgroups
http://nagios.sourceforge.net/docs/3_0/ ... ricks.html

Re: Exclude hostgroup_members

Posted: Tue Oct 15, 2013 12:02 pm
by Wunsch
If you look at the documentation you've linked, it explicitly says that what jessiegto is trying, should work. Unfortunately, it doesn't seem that it does; I'm running into the same issue. I haven't tested Nagios 4.0 yet either, but the documentation that says it should work is for 3.0 (I'm running 3.5.1).

Re: Exclude hostgroup_members

Posted: Tue Oct 15, 2013 12:31 pm
by abrist
I think what Scott was implying is that you cannot use excludes on the hostgroup object definition, whereas you can on the host definitions.

Re: Exclude hostgroup_members

Posted: Mon Oct 21, 2013 11:29 am
by Wunsch
abrist wrote:I think what Scott was implying is that you cannot use excludes on the hostgroup object definition, whereas you can on the host definitions.
He might have been implying that, but the documentation he quoted says otherwise.

Re: Exclude hostgroup_members

Posted: Mon Oct 21, 2013 1:01 pm
by abrist
No where in the document does it mention that hostgroup object definitions can have "excludes" defined in them. You can exclude hostgroups from service/host object definitions, but not from hostgroup definitions. In fact, it only specifically mentions excludes on service object configs:
Excluding Hosts:
If you want to create identical services on numerous hosts or hostgroups, but would like to exclude some hosts from the definition, this can be accomplished by preceding the host or hostgroup with a ! symbol.


define service{

host_name HOST1,HOST2,!HOST3,!HOST4,...,HOSTN

hostgroup_name HOSTGROUP1,HOSTGROUP2,!HOSTGROUP3,!HOSTGROUP4,...,HOSTGROUPN

service_description SOMESERVICE

other service directives ...

}

Re: Exclude hostgroup_members

Posted: Tue Dec 22, 2015 2:42 pm
by ChathamDaleJ
Actually, the docs do mention excluding hostgrops.

Yes, it is core three, not nagios xi. When I try to use as a static config, xi chokes.

If this does not work, IT IS A BIG DEAL.

https://assets.nagios.com/downloads/nag ... ricks.html

I

Code: Select all

f you want to create identical services on numerous hosts or hostgroups, but would like to exclude some hosts from the definition, this can be accomplished by preceding the host or hostgroup with a ! symbol.

	define service{
		host_name             HOST1,HOST2,!HOST3,!HOST4,...,HOSTN
		hostgroup_name                HOSTGROUP1,HOSTGROUP2,!HOSTGROUP3,!HOSTGROUP4,...,HOSTGROUPN
		service_description   SOMESERVICE
		other service directives ...
		}