1

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
}

2 Answers 2

2

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...
}
0

I found a workaround:

create a new hostgroup:

define hostgroup{
     hostgroup_name hg_no-check-swap
     alias exclude check_swap
     register 0
}

add the member to the host

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

and exclude the hostgroup

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

now i can delete the examplehost.domain.local.cfg file, without errors. Nagios Core 4.3.4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .