Is there a way to exclude specific hosts from a Nagios hostgroup?
Add the specific host with a !
prefix in the service definition. The service check below will apply to all hosts in agroup
apart from ahost
.
define service {
hostgroup_name agroup
host_name !ahost
service_description Shared NFS mount
check_command check_nrpe!check_shared_mount
use generic-service
}
Haven't yet tried it with hosts, but with hostgroups, prefixing with a !
works. I use this for running a different load check on busy servers:
define host {
use physical-host
host_name busy-host.example.com
alias busy-host.example.com
address 10.43.16.1
hostgroups linux,centos,ldap,http,busy
}
define host {
use physical-host
host_name normal-host.example.com
alias narmal-host.example.com
address 10.43.1.1
hostgroups linux,centos,dns,proxy,ldap,hp,http,puppetmaster
}
define service {
use generic-service
hostgroup_name linux,!busy
service_description Load
check_command check_snmp_load
}
define service {
use generic-service
hostgroup_name busy
service_description Load
check_command check_snmp_load_busy
}