From fc7655469fd7f6d3c28b31c215c1c623d496e877 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 10 Apr 2021 15:05:29 +0200 Subject: [PATCH] icinga2: add pretty_name for status page --- bundles/icinga2/files/icinga2/hosts.conf | 14 ++++++++++---- nodes/gce/bind01.py | 3 +++ nodes/gce/dns02.py | 3 +++ nodes/gce/dns03.py | 3 +++ nodes/htz-cloud/pirmasens.py | 3 +++ nodes/htz-cloud/pleroma.py | 3 +++ nodes/htz-cloud/sewfile.py | 1 + nodes/voc/pretalx.py | 3 +++ 8 files changed, 29 insertions(+), 4 deletions(-) diff --git a/bundles/icinga2/files/icinga2/hosts.conf b/bundles/icinga2/files/icinga2/hosts.conf index baedc57..53f8600 100644 --- a/bundles/icinga2/files/icinga2/hosts.conf +++ b/bundles/icinga2/files/icinga2/hosts.conf @@ -4,11 +4,17 @@ object Host "${monitored_node.name}" { address = "${monitored_node.metadata.get('icinga_options/hostname', monitored_node.hostname)}" - vars.os = "${monitored_node.os}" - vars.sla = "${monitored_node.metadata.get('sla', '24x7')}" - vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}" - vars.location = "${monitored_node.metadata.get('location', 'unknown')}" + # used for determining service groups vars.bw_groups = [ "${'", "'.join(sorted({group.name for group in monitored_node.groups}))}" ] + vars.location = "${monitored_node.metadata.get('location', 'unknown')}" + vars.os = "${monitored_node.os}" + + # used for status page + vars.pretty_name = "${monitored_node.metadata.get('icinga_options/pretty_name', monitored_node.name)}" + + vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}" + vars.sla = "${monitored_node.metadata.get('sla', '24x7')}" + vars.notification.sms = ${str(monitored_node.metadata.get('icinga_options/vars.notification.sms', True)).lower()} vars.notification.mail = true } diff --git a/nodes/gce/bind01.py b/nodes/gce/bind01.py index 7f194c5..6d2d91c 100644 --- a/nodes/gce/bind01.py +++ b/nodes/gce/bind01.py @@ -22,6 +22,9 @@ nodes['gce.bind01'] = { }, }, 'external_ipv4': '34.89.208.78', + 'icinga_option': { + 'pretty_name': 'ns-1.kunbox.net', + }, 'nginx': { 'vhosts': { 'ns-1.kunbox.net': { diff --git a/nodes/gce/dns02.py b/nodes/gce/dns02.py index 2db025e..4a0fe21 100644 --- a/nodes/gce/dns02.py +++ b/nodes/gce/dns02.py @@ -18,6 +18,9 @@ nodes['gce.dns02'] = { }, }, 'external_ipv4': '35.187.109.249', + 'icinga_option': { + 'pretty_name': 'ns-2.kunbox.net', + }, 'backups': { 'exclude_from_backups': True, }, diff --git a/nodes/gce/dns03.py b/nodes/gce/dns03.py index aa28870..cb7f94e 100644 --- a/nodes/gce/dns03.py +++ b/nodes/gce/dns03.py @@ -18,6 +18,9 @@ nodes['gce.dns03'] = { }, }, 'external_ipv4': '35.228.143.71', + 'icinga_option': { + 'pretty_name': 'ns-3.kunbox.net', + }, 'backups': { 'exclude_from_backups': True, }, diff --git a/nodes/htz-cloud/pirmasens.py b/nodes/htz-cloud/pirmasens.py index 437b009..22d30ee 100644 --- a/nodes/htz-cloud/pirmasens.py +++ b/nodes/htz-cloud/pirmasens.py @@ -23,6 +23,9 @@ nodes['htz-cloud.pirmasens'] = { 'gateway6': 'fe80::1', }, }, + 'icinga_options': { + 'pretty_name': 'kunsmann.info', + }, 'nginx': { 'vhosts': { 'mail.kunsmann.info': { diff --git a/nodes/htz-cloud/pleroma.py b/nodes/htz-cloud/pleroma.py index 960f3bb..a7473db 100644 --- a/nodes/htz-cloud/pleroma.py +++ b/nodes/htz-cloud/pleroma.py @@ -19,6 +19,9 @@ nodes['htz-cloud.pleroma'] = { 'gateway6': 'fe80::1', }, }, + 'icinga_options': { + 'pretty_name': 'cybert-media.net', + }, 'cron': { 'auto-authorize-sm-users': '* * * * * root echo "UPDATE users SET approval_pending=false WHERE email LIKE \'\\%@seibert-media.net\' AND approval_pending=true;" | psql pleroma >/dev/null', }, diff --git a/nodes/htz-cloud/sewfile.py b/nodes/htz-cloud/sewfile.py index fe78fd2..fb23a03 100644 --- a/nodes/htz-cloud/sewfile.py +++ b/nodes/htz-cloud/sewfile.py @@ -38,6 +38,7 @@ nodes['htz-cloud.sewfile'] = { }, }, 'icinga_options': { + 'pretty_name': 'sewfile.franzi.business', 'vars.notification.sms': False, }, 'nginx': { diff --git a/nodes/voc/pretalx.py b/nodes/voc/pretalx.py index 0a44839..3058014 100644 --- a/nodes/voc/pretalx.py +++ b/nodes/voc/pretalx.py @@ -31,6 +31,9 @@ nodes['voc.pretalx'] = { 'gateway6': '2a01:a700:48d1::1', }, }, + 'icinga_options': { + 'pretty_name': 'pretalx.c3voc.de', + }, 'nginx': { 'vhosts': { 'pretalx': {