Excluding hostgroup_members


#1

I want to setup a host group that contains all hosts except a few hosts. So, assume I have the following:

define hostgroup {
hostgroup_name all_servers
alias All Servers
members *
}

define hostgroup {
hostgroup_name production_servers
alias Production Servers
members prod01, prod02, prod03, prod04, prod05
}

I would also like to have a host group for test servers. The idea is that if a server is not a production server, then it is a test server. Therefore I would like to define the following host group for test servers:

define hostgroup {
hostgroup_name test_servers
alias Test Servers
hostgroup_members all_servers, !production_servers
}

The problem is: Nagios does not handle the hostgroup test_servers properly. It includes ALL servers (test and production) and does not exclude the servers in the production_servers list.

How do I get this working?


#2

nagios.sourceforge.net/docs/3_0/ … ricks.html

I’d try without the space… what happens running the config verify option?


#3

Removing the space does not help.

When checking the configuration:

$> nagios3 -v nagios.cfg
Error: Could not find member group '!production_servers' specified in hostgroup (config file '/etc/nagios3/conf.d/hostgroups.cfg)

I have also tried to play around with ‘use_regexp_matching’ and ‘use_true_regexp_matching’, but this doesn’t help either.