Set check_source of a Service to specific zone


#1

Hi All,
icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.2-1)
I have a distributed cluster (master,zone1,zone2) running. Each Zone got 2 Satelites as check executor, 1 master on top.
My config tree is:
Zones.d:

  • global-templates
    • service/ipmi.conf
  • master
  • zone1
    • host
  • zone2
    • host
      -ServerX

In zone 2 is a server which should be checked by the zone2 sats, with the exception of one explicit service.
This one check must be executed by the zone1 Sats.
So I thought moving the service configuration from “global-templates/service” to “zone1/service” would work and let only the zone1 sats execute this service.
But because the host config itself is in zone 2, the check_source stayed at the zone2 sats, too.
I tried “command_endpoint = host.zone” but that seems to be incorrect.
I don’t want to set "command_endpoint = “decicated zone1.host” " because of HA.
And as I thought every service, who is stored in the “zones1” directory is only valid for this zone only, I am surprised, that the zones2 satelites still executed this check.
The check itself is applied on host.vars.ipmi_address in the host config (@zone2).
So how do I set the check_source of a host in Zone2 to the Sats of Zone1?

Thanks in advance,
Marcus


(Carsten Köbke) #2

Hello Marcus,

You cant check a host that is in a different zone then the satellites. The Satellites know only the hosts that are cofigured in their zone.
You can create a host in zone1 with the ip of the ipmi interface and only assign the services you need there.

Best regards,
Carsten


(Nicolai) #3

I think the zone parameter is what you’re looking for:

apply Service "ipmi" {
   // [... ] 
   command_endpoint = "management-sat"
   zone = "management" 
   assign where host.vars.ipmi
}

#4

Unfortunately that does not work for hosts, who are configured in zone2 when zone = zone1:

[2018-11-28 10:50:26 +0100] critical/config: Error: Validation failed for object ‘HOSTNAME!ipmi sensor’ of type ‘Service’; Attribute ‘zone’: Object ‘zone1’ of type ‘Zone’ does not exist.

Only way that seems to work is set zone = master and let the master check it.


(Nicolai) #5

This should only be rendered in the corresponding zone / satellites:

   // [... ] 
   command_endpoint = "management-sat"
   zone = "management" 

   assign where host.vars.ipmi && ZoneName == "management"

(Carsten Köbke) #6

This will still not work if the host is in a different zone then the service should run in…


(Michael Friedrich) #7

Setting the zone parameter without knowing about its consequences is dangerous and may break your entire cluster. I wouldn’t suggest that to anyone except for the mentioned use cases in the docs.


#8

good to know, thanks michi