From 4d5e75df6832c123230c0d860f1102b937484978 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 17 Apr 2021 03:43:08 +0200 Subject: [PATCH] bundles/icinga2: introduce icinga_options/downtime_also_for --- bundles/icinga2/files/icinga2/downtimes.conf | 16 ++++++++++++++++ nodes/home/nas.py | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/bundles/icinga2/files/icinga2/downtimes.conf b/bundles/icinga2/files/icinga2/downtimes.conf index 31195be..229e8e3 100644 --- a/bundles/icinga2/files/icinga2/downtimes.conf +++ b/bundles/icinga2/files/icinga2/downtimes.conf @@ -14,5 +14,21 @@ 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/nodes/home/nas.py b/nodes/home/nas.py index fe68d1e..09ae5cc 100644 --- a/nodes/home/nas.py +++ b/nodes/home/nas.py @@ -50,6 +50,13 @@ 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