My setup is standard master-satellite(s)-agents. It works well since years. Now I’ve added some new hosts to one of the satellites and (only) one agent makes trouble and I don’t know, where to look for the reason.
On master there is a zones.conf with
object Endpoint "universe" {
host = "<ip>"
port = "5665"
}
object Zone "universe" {
endpoints = [ "universe" ]
}
object Endpoint "sun" {
host = "<ip>"
port = "5665"
}
object Zone "sun" {
parent = "universe"
endpoints = [ "sun" ]
}
# several...other zones
Then there is a zones.d/sun folder with three files
the hosts.conf contains the host objects, and the services.conf contains a lot of assign service rules. It looks like 1 day ago it worked. But today I see on “sun” in icinga log
Config validation failed for staged cluster config sync in '/var/lib/icinga2/api/zones-stage/'. Aborting. Logs: '/var/lib/icinga2/api//zones-stage-startup-last-failed.log'
and failed log
Error: Object 'saturn.sol.home' of type 'Host' re-defined: in /var/lib/icinga2/api/zones-stage//saturn.sol.home/_etc/hosts.conf: 3:1-3:29; previous definition: in /var/lib/icinga2/api/zones-stage//sun/_etc/hosts.conf: 131:1-131:29
And thats correct, the generated files contain host definition on sun and there is a zone containing the host “saturn”. But I dont understand, why this happens and why this is not happens on all other satellites and there is no zone venus or mercury.
Aha, ok, did not know that. I’m not really sure, if I understood the documentation. It is a little bit confusing to me. There is a zone master/universe a satellite zone “sun” whcih contain agents. And yes, then there is a zone “saturn” and I don’t need to define a zone for that? And only because it is defined in the folder structure for satellite “sun” its known as an agent for zone “sun” (because in my understanding that was the main reason to define a zone, because you can define a “parent-zone”)
But why is the rest of the setup is still working then?
The problem with failed.log is solved. The config was generated, and during the first run, I didn’t defined saturn as a child of sun, so the generator creates a saturn-zone under universe, that was written to /var/lib/icinga2/api/zones on the master. After “moving” saturn in our CMDB under “sun” the configuration was recreated. But somehow, the original zone under /var/lib/icinga2/api/zones was not removed.