Does the "zone = master" trick still work on 2.11?

Hi,
I’ve noticed that when setting the zone = master “trick” on the agent host

object Host “agent-01.local” {
address = “10.X.X.X”
groups = [ “linux-nodes-hg”, ]
display_name = “agent-01.local”
check_command = “hostalive”
zone = "master"
vars.client_endpoint = name
}

I get

root@agent-02.local:# cat /var/lib/icinga2/api/zones-stage//startup.log
[2020-07-27 15:07:43 +0000] information/cli: Icinga application loader (version: r2.11.4-1)
[2020-07-27 15:07:43 +0000] information/cli: Loading configuration file(s).
[2020-07-27 15:07:43 +0000] information/ConfigItem: Committing config item(s).
[2020-07-27 15:07:43 +0000] information/ApiListener: My API identity: agent-02.local
[2020-07-27 15:07:43 +0000] critical/config: Error: Validation failed for object ‘agent-02.local’ of type ‘Host’; Attribute ‘zone’: Object ‘master’ of type ‘Zone’ does not exist.
Location: in /var/lib/icinga2/api/zones-stage//agent-02.local/_etc/hosts.conf: 8:3-8:17
/var/lib/icinga2/api/zones-stage//agent-02.local/_etc/hosts.conf(6): display_name = “agent-02.local”
/var/lib/icinga2/api/zones-stage//agent-02.local/_etc/hosts.conf(7): check_command = “hostalive”
/var/lib/icinga2/api/zones-stage//agent-02.local/_etc/hosts.conf(8): zone = "master"
^^^^^^^^^^^^^^^
/var/lib/icinga2/api/zones-stage//agent-02.local/_etc/hosts.conf(9): vars.client_endpoint = name
/var/lib/icinga2/api/zones-stage//agent-02.local/_etc/hosts.conf(10): }

[2020-07-27 15:07:43 +0000] critical/config: 1 error
[2020-07-27 15:07:43 +0000] critical/cli: Config validation failed. Re-run with ‘icinga2 daemon -C’ after fixing the config.

Any quick hint on which case this can happen?
Thanks in advance.

Hello, the error is pretty self explanatory :

[2020-07-27 15:07:43 +0000] critical/config: Error: Validation failed for object ‘agent-02.local’ of type ‘Host’; Attribute ‘zone’: Object ‘master’ of type ‘Zone’ does not exist.

If you want your configuration to compile, you either need to explicitely declare a zone named “master” in your zones.conf file or remove the zone = “master” from the Host definition.

Also, this could come handy :
https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#zones

Hi “Someone”, thanks for your reply.
I didn’t explain myself exhaustively enough.
I’m referring to the trick mentioned in https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#top-down-config-sync
which says exactly:

Add the host and service objects you want to monitor. There is no limitation for files and directories – best practice is to sort things by type. By convention a master/satellite/agent host object should use the same name as the endpoint object. You can also add multiple hosts which execute checks against remote services/agents via command endpoint checks.

[root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/satellite
[root@icinga2-master1.localdomain /etc/icinga2/zones.d/satellite]# vim hosts.conf

object Host “icinga2-satellite1.localdomain” {
check_command = “hostalive”
address = “192.168.56.112”
zone = “master” //optional trick: sync the required host object to the satellite, but enforce the “master” zone to execute the check
}

In newer versions of Icinga you need to specify the zone in zones.conf. It will not work, if you declare the zone somewhere else in the configuration, like the director will do for example. Maybe your agent/Satellite does not have the masterzone in the zones.conf defined

Thanks for the confirmation.
Have a good day.