Trouble creating service dependency

Hi. . . I’m trying to create a service dependency. We have an address validation web service which I check with a service check called AddrValidation. It does this for two hosts so I get qa!AddrValidation and uat!AddrValidation which appear in the list of services. We have multiple environments which consume those services called UAT1-addrvalidation, UAT2-addrvalidation, etc. I’m trying to create a dependency so that the individual environment checks don’t run if the main service is down so I have this:

apply Dependency "addravail_calls-depon-addravail_svc" to
  Service { 
  parent_service_name = "qa!AddrValidation"

  states = [ OK ]
  disable_checks = true
  disable_notifications = true
  assign where match("*-addrvalidation", service.name)
}

However, it can’t find the parent service, reporting:

[2019-07-10 09:19:35 -0700] critical/config: Error: Dependency 'scan-host.example.org!WIT2-addrvalidation!addravail_calls-depon-addravail_svc' references a parent host/service which doesn't exist.
Location: in /etc/icinga2/conf.d/dependencies.conf: 1:0-1:64
/etc/icinga2/conf.d/dependencies.conf(1): apply Dependency "addravail_calls-depon-addravail_svc" to Service {
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/conf.d/dependencies.conf(2):   parent_service_name = "qa!AddrValidation"

I’ve tried variants of the parent service name such as excluding the host portion (qa!).

The service name I’m using appears in the object list command so I know it’s there. Is there something I’m missing?

Andy

Hi,

parent_service_name must be the short service name, e.g. AddrValidation. The tuple with the host must be specified with parent_host_name being qa. Throughout the configuration language, the “long” service name isn’t visible/used. You’ll only see them with object list and within the REST API (and logs of course).

Cheers,
Michael

Thanks, Michael, that worked! I had tried the short name but was missing parent_host_name. I didn’t realize it was mandatory but I guess in hindsight it makes sense.