From bbc69dfd25cb316e5d4506ce51215ada7ac19605 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 20 Apr 2024 18:30:39 +0200 Subject: [PATCH] bundles/icinga2: re-add statusmonitor --- bundles/icinga2/items.py | 28 +++++++++++++++++++++++----- bundles/icinga2/metadata.py | 4 ++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bundles/icinga2/items.py b/bundles/icinga2/items.py index 2632de2..804d920 100644 --- a/bundles/icinga2/items.py +++ b/bundles/icinga2/items.py @@ -275,6 +275,27 @@ files = { 'mode': '0660', 'group': 'icingaweb2', }, + + # monitoring + '/etc/icinga2/icinga_statusmonitor.py': { + 'triggers': { + 'svc_systemd:icinga_statusmonitor:restart', + }, + }, + '/usr/local/lib/systemd/system/icinga_statusmonitor.service': { + 'triggers': { + 'action:systemd-reload', + 'svc_systemd:icinga_statusmonitor:restart', + }, + }, +} + +svc_systemd['icinga_statusmonitor'] = { + 'needs': { + 'file:/etc/icinga2/icinga_statusmonitor.py', + 'file:/usr/local/lib/systemd/system/icinga_statusmonitor.service', + 'pkg_apt:python3-flask', + }, } actions = { @@ -316,15 +337,12 @@ for name in files: for name in symlinks: icinga_run_deps.add(f'symlink:{name}') -svc_systemd = { - 'icinga2': { - 'needs': icinga_run_deps, - }, +svc_systemd['icinga2'] = { + 'needs': icinga_run_deps, } - # The actual hosts and services management starts here bundles = set() downtimes = [] diff --git a/bundles/icinga2/metadata.py b/bundles/icinga2/metadata.py index 8c9cc14..494ff89 100644 --- a/bundles/icinga2/metadata.py +++ b/bundles/icinga2/metadata.py @@ -19,6 +19,7 @@ defaults = { 'icingaweb2': {}, 'icingaweb2-module-monitoring': {}, 'python3-easysnmp': {}, + 'python3-flask': {}, 'snmp': {}, } }, @@ -131,6 +132,9 @@ def nginx(metadata): '/api/': { 'target': 'https://127.0.0.1:5665/', }, + '/statusmonitor/': { + 'target': 'http://127.0.0.1:5000/', + }, }, 'extras': True, },