diff --git a/bundles/icinga2/files/icinga2/downtimes.conf b/bundles/icinga2/files/icinga2/downtimes.conf index 229e8e3..31195be 100644 --- a/bundles/icinga2/files/icinga2/downtimes.conf +++ b/bundles/icinga2/files/icinga2/downtimes.conf @@ -14,21 +14,5 @@ object ScheduledDowntime "unattended_upgrades" { child_options = "DowntimeTriggeredChildren" } -% for also_host in sorted(monitored_node.metadata.get('icinga_options/downtime_also_for', set())): -object ScheduledDowntime "unattended_upgrades_also_for_${also_host}" { - host_name = "${repo.get_node(also_host).name}" - - author = "upgrade-and-reboot" - comment = "Downtime for upgrade-and-reboot of ${monitored_node.name}" - - fixed = true - - ranges = { - "${days[monitored_node.metadata.get('apt/unattended_upgrades/day', 5)]}" = "01:${monitored_node.magic_number%30}-01:${(monitored_node.magic_number%30)+30}" - } - - child_options = "DowntimeTriggeredChildren" -} -% endfor % endif % endfor diff --git a/bundles/icinga2/files/icinga2/hosts.conf b/bundles/icinga2/files/icinga2/hosts.conf index 53f8600..2399637 100644 --- a/bundles/icinga2/files/icinga2/hosts.conf +++ b/bundles/icinga2/files/icinga2/hosts.conf @@ -18,6 +18,16 @@ object Host "${monitored_node.name}" { vars.notification.sms = ${str(monitored_node.metadata.get('icinga_options/vars.notification.sms', True)).lower()} vars.notification.mail = true } +% for depends_on_host in sorted(monitored_node.metadata.get('icinga_options/also_affected_by', set())): +object Dependency "${monitored_node.name}_depends_on_${depends_on_host}" { + parent_host_name = "${depends_on_host}" + child_host_name = "${monitored_node.name}" + states = [ Up ] + disable_checks = true + disable_notifications = true + ignore_soft_states = true +} +% endfor % endfor apply Dependency "disable-service-checks-on-host-down" to Service { diff --git a/nodes/home/nas.py b/nodes/home/nas.py index 09ae5cc..fe68d1e 100644 --- a/nodes/home/nas.py +++ b/nodes/home/nas.py @@ -50,13 +50,6 @@ nodes['home.nas'] = { 'groups': { 'nas': {}, }, - 'icinga_options': { - 'downtime_also_for': { - # FIXME maybe autogenerate that from bundle:vmhost? - 'home.router', - 'home.downloadhelper', - }, - }, 'iptables': { 'port_rules': { '4679': { # Dell ULNM diff --git a/nodes/home/router.py b/nodes/home/router.py index 50fa459..4390bef 100644 --- a/nodes/home/router.py +++ b/nodes/home/router.py @@ -74,9 +74,14 @@ nodes['home.router'] = { }, }, 'icinga_options': { + 'also_affected_by': { + 'home.nas', + 'ovh.wireguard', + }, # disabled on group level 'vars.notification.sms': True }, + 'iptables': { 'custom_rules': [ # This is a router. Allow forwarding traffic for internal networks.