Nagios exclude a service for a single host

monitoringnagios

How i can exclude a inherited service for a singe host, without editing my service file?


i have in my conf.d directory many files, one for each host, hostgroup, template and service.

hg_linux-server.cfg

define hostgroup{
    hostgroup_name hg_linux-server
    alias Linux-Server
}

check_swap.cfg

define service{
    service_description check_swap
    check_command check_nrpe!check_swap
    hostgroup_name hg_linux-server
    [...] #more options...
}

t_linux-server.cfg

define host{
    name t_linux-server
    hostgroups hg_linux-server
    register 0
    [...] #more options...
}

examplehost.domain.local.cfg

define host{
    use t_linux-server
    host_name examplehost
    alias examplehost.domain.local
    address 192.168.0.2
}

Best Answer

You can't... without editing the service definition.

The way to exclude examplehost from your service is:

define service{
  service_description check_swap
  check_command check_nrpe!check_swap
  hostgroup_name hg_linux-server
  host_name !examplehost
  [...] #more options...
}