Can't figure out circular dependency in 2.14

After an upgrade to Icinga2 2.14 I got a circular dependency error:

[2024-11-13 09:25:52 +0100] critical/config: Error: Dependency cycle:
Service 'my.host.name!disk_smb'
-> Dependency 'my.host.name!disk_smb!master-connection-check'
-> Service 'my.host.name!master-connection-health'
-> Dependency 'my.host.name!master-connection-health!master-connection-check'
-> Service 'my.host.name!master-connection-health'
[2024-11-13 09:25:52 +0100] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.

I cannot find said dependency. I can see the master-connection-check dependency here:

apply Dependency "master-connection-check" to Service {
  parent_service_name = "master-connection-health"

  states = [ OK ] // Fail if the parent service state switches to NOT-OK
  disable_notifications = true

  assign where host.vars.agent_endpoint // Automatically assigns all agent endpoint checks as child services on the matched host
  ignore where service.name == "agent-health" // Avoid a self reference from child to parent
}

apply Service "master-connection-health" {
  check_command = "cluster-zone"

  display_name = "cluster-health-master"

  /* This follows the convention that the agent zone name is the FQDN which is the same as the host object name. */
  vars.cluster_zone = "master"

  command_endpoint = host.name

  assign where host.vars.agent_endpoint
}

The service in question is configured like this:

apply Service "disk_smb" {
  import "generic-service"

  check_command = "disk_smb"

  command_endpoint = host.name

  assign where host.vars.disk_smb != ""
}

And finally, the generic service template is

template Service "generic-service" {
  max_check_attempts = 5
  check_interval = 1m
  retry_interval = 30s
}

I can’t see the “circular dependency” and therefore have no idea how to resolve this. I only have one dependency configured, which is the master-connection-health.

Configuring every check as a child (assign where host.vars.agent_endpoint) sounds like a reasonable idea, but I think this might be the culprit? :thinking:

Any hints on how to fix this are highly appreciated.

The Service master-connection-health has a dependency to itself.

Maybe adapt ignore where service.name == "agent-health" to something like

ignore where service.name == "agent-health"  ||  service.name == "master-connection-health" 

but I did not fully comprehend the config to be honest.

You can find the corresponding change in the Changelog for 2.14.0

.

2.14.0 (2023-07-12)
Icinga 2 Config DSL

  • Forbid Dependency cycles at config load time. #8389

Yep, that did the trick here.

Thanks for pointing out the dependency, I was mislead by the smb check.