bundles/icinga2: remove icinga_options/downtime_also_for, add host dependencies via icinga_options/also_affected_by
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-04-17 09:21:51 +02:00
parent 4d5e75df68
commit 4973c63e62
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 15 additions and 23 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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.