Page 1 of 1

hostgroups.cfg

Posted: Wed Jul 02, 2014 1:21 pm
by smcracraft
Hi,

I want to create a hostgroup which has all my db servers (assume "database" is in the hostname)
and another hostgroup which has all my non-db servers (the ones that don't have "database" in the hostname.)

Assume all that there is presently is one hostgroup "all" which has everything.

A question about one solution:

step 1) modify hostgroups.cfg.erb

add:
define hostgroup {
hostgroup_name database_servers
alias All database servers
members ^.*database.*$
}
define hostgroup {
hostgroup_name non-database_servers
alias Not database servers
members !database_servers
}

step 2) modify /etc/nagios/nagios.cfg
use_regexp_matching=1
use_true_regexp_matching=0

step3) reload nagios
service nagios reload

Any problems with the above?

Is there a way to do it without regexp without explicit listing of the hostgroup?

Conversely, in services.cfg, is there a way for a defined service
to omit a certain class of hosts within the define service {}?

Thanks.

Re: hostgroups.cfg

Posted: Wed Jul 02, 2014 4:26 pm
by Box293
I've played with this before and you cannot perform exclusions in servicegroups or hostgroups.

Re: hostgroups.cfg

Posted: Wed Jul 02, 2014 8:43 pm
by smcracraft
Box, this appears to back you up completely:

http://support.nagios.com/forum/viewtop ... =7&t=21500

Re: hostgroups.cfg

Posted: Thu Jul 03, 2014 11:23 am
by lmiltchev
You are correct - you cannot exclude hostgroups from hostgroup definitions.