Dependency for internet connection

We like to create a dependency for internet connections. When the internet connection is down, all service checks, host checks and notifications should stop.

We created a service checks called “Internet Connection”. It’s a simple ping check which sends ping to the Icinga2 Master. If the service check fails, all service checks should stop.

The problem is that the rule is not applied anywhere. We checked it with the command “icinga2 object list --type Dependency”.

Do you have any suggestions that could help fix the problem?

template Dependency "Internet_Dependency" {
    disable_checks = true
    disable_notifications = true
    ignore_soft_states = false
    period = "24_7"
}

apply Dependency "Internet-ACME-Host" to Host {

import "Internet_Dependency"

parent_host_name = "icinga2.acme.com"
parent_service_name = "Internet Connection"

assign where "acme.com" in host.groups && where host.name != "icinga2.acme.com"

}


apply Dependency "Internet-ACME-Service" to Service {

import "Internet Dependency"

parent_host_name = "icinga2.acme.com"
parent_service_name = "Internet Connection"

assign where "acme.com" in host.groups && where service.name != "Internet Connection"
}

apply Dependency “Internet-ACME-Host” to Host {

import "Internet_Dependency"

parent_host_name = "icinga2.acme.com"
parent_service_name = "Internet Connection"

assign where "acme.com" in host.groups && where "host.name != "icinga2.acme.com

}

parent_host_name = “icinga2.acme.com
assign … host.name != “icinga2.acme.com

Check your negation

assign where “acme.com” in host.groups

assign where match (“acme.com”, host.groups)

But I am not shure if that works for host groups. If not - try it with assign where match ("*acme.com", host.name)

The second where in your assign statement is to remove or even better (at least for reading) I’d recommend:

assign where "acme.com" in host.groups
ignore where host.name == "icinga2.acme.com"
2 Likes