hostgroups.cfg
Posted: Wed Jul 02, 2014 1:21 pm
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.
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.