Can a service in a child zone refer to a host object in a parent zone

I have a master zone that defines object Host "myhost.mydomain". And I have a satellite zone has the master zone as its parent and that refers to host_name = "myhost.mydomain" in a Service definition. (The reason why I placed this host in the master zone is because I want its hostalive ping to originate from the master.)

This setup apparently fails. When I enable debuglog it contains a reference to /var/lib/icinga2/api/zones-stage-startup-last-failed.log and there the error reads “Object ‘myhost.mydomain’ of type ‘Host’ does not exist”. So can a child zone not refer to objects from its parents, I thought it can?

One the one hand I see only subdirectories for the child zone (and global zones) below /var/lib/icinga2/api/zones/ on myhost. So that suggests no. The book “Icinga 2: Ein praktischer Einstieg ins Monitoring” says on page 204 “damit gehört jees Objekt, dass im Verzeichnis dmz defifniert ist automatisch zur Zone master”. That also suggests no.

On the other hand icinga2 object list -t host on myhost prints Object 'myhost.mydomain' of type 'Host'. So that suggests yes. The documentation says " the trust hierarchy allows for example the master zone to send configuration files to the satellite zone". (etc/icinga2/features-enabled/api.conf on myhost contains accept_config = true.) So that also kind of suggests yes.

Which one is it? What could I be doing wrong? Perhaps I have got the direction of inheritance wrong.

Hello @ch2!

Place Host and Service in the child zone, but with:

object Host {
  zone = "<PARENT ZONE NAME>"
}

Best,
A/K

2 Likes

Thank you very much.