# Health-check dependency

**URL:** <https://community.icinga.com/t/health-check-dependency/1618>\
**Category:** Service Monitoring\
**Created:** [July 3, 2019, 6:01pm UTC](https://community.icinga.com/t/health-check-dependency/1618 "2019-07-03T18:01:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yungd](https://community.icinga.com/letter_avatar_proxy/v4/letter/y/ba9def/32.png) [@yungd](https://community.icinga.com/u/yungd)\
**Post date:** [July 3, 2019, 6:01pm UTC](https://community.icinga.com/t/health-check-dependency/1618/1 "2019-07-03T18:01:01Z")

</div>

I’m following the [health check section](https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#health-checks) and I’m stuck on applying the dependency “health-checks” to all of the services.

```
apply Dependency "health-check" to Service {
  parent_service_name = "child-health"

  states = [OK]
  disable_notifications = true

  assign where host.vars.client_endpoint
  ignore where service.name == "child-health"
}

```

The error message that I’m receiving is:

` **critical** /config: Error: Dependency 'icinga2-client.localhost!ssh!health-check' references a parent host/service which doesn't exist.`

Since there is a “parent\_service\_name” variable, am I supposed to make an empty service for “child-health”? I’m not sure what should go here and I can’t find any resources that explains this.

```
apply Service "child-health" {
  import "generic-service"
  command_endpoint = host.vars.client_endpoint
}
```

---

<div class="post-metadata">

**Author:** ![dflach](https://community.icinga.com/user_avatar/community.icinga.com/dflach/32/120_2.png) [@dflach](https://community.icinga.com/u/dflach)\
**Post date:** [July 4, 2019, 9:10am UTC](https://community.icinga.com/t/health-check-dependency/1618/2 "2019-07-04T09:10:59Z")

</div>

You do need a parent for dependencies, it is what triggers it.  
If you had a Service child-health on a Host and the client\_endpoint the Dependency will apply to all other Services of that Host and disable notifications when child-health goes down.

Vice versa, every Host with client\_endpoint set now also needs a child-health Service. But instead of adding an empty service with that name that does not do anything, you can modify your assign where with an additional match like  
`assign where host.vars.client_endpoint && host.vars.check_health` and set check\_health on the Hosts you want to have a dependency.

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [July 4, 2019, 9:39am UTC](https://community.icinga.com/t/health-check-dependency/1618/3 "2019-07-04T09:39:45Z")

</div>

There’s a typo in the docs - the above example marks the service as `cluster-health` which should be used in the dependency - the service which executes the `cluster-zone` checkcommand should be used as parent.

> <https://github.com/Icinga/icinga2/pull/7279>
