icinga2/doc/6.06-dependencies.md

44 lines
1.6 KiB
Markdown
Raw Normal View History

## <a id="dependencies"></a> Dependencies
Icinga 2 uses host and service [Dependency](#objecttype-dependency) objects either directly
2014-04-06 18:26:23 +02:00
defined or as inline definition as `dependencies` dictionary. The `parent_host_name` and `parent_service_name`
attributes are mandatory.
A service can depend on a host, and vice versa. A service has an implicit dependency (parent)
to its host. A host to host dependency acts implicit as host parent relation.
When dependencies are calculated, not only the immediate parent is taken into
account but all parents are inherited.
A common scenario is the Icinga 2 server behind a router. Checking internet
access by pinging the Google DNS server `google-dns` is a common method, but
will fail in case the `dsl-router` host is down. Therefore the example below
defines a host dependency which acts implicit as parent relation too.
2014-03-29 01:13:28 +01:00
Furthermore the host may be reachable but ping probes are dropped by the
router's firewall. In case the `dsl-router``ping4` service check fails, all
2014-03-29 01:13:28 +01:00
further checks for the `ping4` service on host `google-dns` service should
be suppressed. This is achieved by setting the `disable_checks` attribute to `true`.
object Host "dsl-router" {
2014-04-11 12:40:20 +02:00
address = "192.168.1.1"
}
object Host "google-dns" {
2014-04-11 12:40:20 +02:00
address = "8.8.8.8"
2014-03-29 01:13:28 +01:00
}
apply Service "ping4" {
import "generic-service"
2014-03-29 01:13:28 +01:00
check_command = "ping4"
2014-04-11 12:40:20 +02:00
assign where host.address
2014-03-29 01:13:28 +01:00
}
2014-04-05 14:53:12 +02:00
apply Dependency "internet" to Service {
2014-04-06 18:26:23 +02:00
parent_host_name = "dsl-router"
2014-03-29 01:13:28 +01:00
disable_checks = true
assign where host.name != "dsl-router"
}