2

I have a hostgroup A for which several services are defined using the hostgroup_name directive in their service template. Among several other hostgroups which hosts are also members of hostgroup A there is one hostgroup for which I want to override one of the services that it implicitly inherits from hostgroup A. Is this possible?

I tried defining a service for this particular hostgroup with the same service description but that had no effect.

I also tried to exclude the hostgroup from the service template I mentioned with no success. The hostgroup where I want to override a service is defined after the service template and thus !hostgroup-b cannot be expanded.

Is there a simple solution to this or should I reorganize my configs?


Example:

# hostgroup-a.cfg

# hostgroup A
define hostgroup {
        hostgroup_name hostgroup-a
}

define host {
        name host-a
        register 0
        use linux-server
        hostgroups hostgroup-a
}

# service template for services for hostgroup A
define service {
        name hostgroup-a-service
        register 0
        use generic-service
        hostgroup_name hostgroup-a
}

# PING example service
define service {
        use hostgroup-a-service
        service_description PING
        check_command check-host-alive
}

For the following hostgroup I want to remove or override the PING service implicitly inherited from hostgroup-a.

# hostgroup-b.cfg

# hostgroup b
define hostgroup {
        hostgroup_name hostgroup-b
}

define host {
        name host-b
        use host-a
        register 0
        hostgroups +hostgroup-b
}
lukad
  • 121
  • 5

1 Answers1

0

I figured my configuration was too complex so I just removed the implicitly inherited services which I wanted to override and defined them separately for each hostgroup to reduce complexity. This way it's easier to maintain.

lukad
  • 121
  • 5
  • Dammit, no :) I have the same problem. So does this [guy](http://serverfault.com/questions/612930/overriding-nagios-hostgroup-service-with-host-service). – mhvelplund Jul 02 '15 at 07:19