From e8d131b0417a74085c7bdabb2ef54c254fd9d209 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 2 Jan 2021 14:47:11 +0100 Subject: [PATCH] add simple-icinga-dashboard on status.franzi.business fixes #20 --- .../simple-icinga-dashboard/files/config.conf | 11 ++++++ bundles/simple-icinga-dashboard/items.py | 38 +++++++++++++++++++ bundles/simple-icinga-dashboard/metadata.py | 12 ++++++ .../powerdns/files/bind-zones/franzi.business | 3 ++ nodes/ovh/icinga2.py | 21 +++++++++- 5 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 bundles/simple-icinga-dashboard/files/config.conf create mode 100644 bundles/simple-icinga-dashboard/items.py create mode 100644 bundles/simple-icinga-dashboard/metadata.py diff --git a/bundles/simple-icinga-dashboard/files/config.conf b/bundles/simple-icinga-dashboard/files/config.conf new file mode 100644 index 0000000..74e131e --- /dev/null +++ b/bundles/simple-icinga-dashboard/files/config.conf @@ -0,0 +1,11 @@ +[icinga2_api] +baseurl = ${api_url} +username = ${api_user} +password = ${api_password} + +[filters] +hosts = ${host_filter} +services = ${service_filter} + +[output] +filename = /opt/simple-icinga-dashboard/out/index.html diff --git a/bundles/simple-icinga-dashboard/items.py b/bundles/simple-icinga-dashboard/items.py new file mode 100644 index 0000000..c1f70fe --- /dev/null +++ b/bundles/simple-icinga-dashboard/items.py @@ -0,0 +1,38 @@ +users = { + 'icinga_dashboard': { + 'home': '/opt/simple-icinga-dashboard', + }, +} + +directories = { + '/opt/simple-icinga-dashboard/out': { + 'owner': 'icinga_dashboard', + }, + '/opt/simple-icinga-dashboard/src': {}, +} + +git_deploy = { + '/opt/simple-icinga-dashboard/src': { + 'repo': 'ssh://git@git.kunsmann.eu/sophie/simple-icinga-dashboard.git', + 'rev': 'main', + }, +} + +files = { + '/opt/simple-icinga-dashboard/src/config.conf': { + 'content_type': 'mako', + 'context': node.metadata['simple-icinga-dashboard'], + 'needs': { + 'git_deploy:/opt/simple-icinga-dashboard/src', + }, + }, +} + +symlinks = { + '/opt/simple-icinga-dashboard/out/bootstrap.min.css': { + 'target': '/opt/simple-icinga-dashboard/src/bootstrap.min.css', + 'needs': { + 'git_deploy:/opt/simple-icinga-dashboard/src', + }, + }, +} diff --git a/bundles/simple-icinga-dashboard/metadata.py b/bundles/simple-icinga-dashboard/metadata.py new file mode 100644 index 0000000..9b8d892 --- /dev/null +++ b/bundles/simple-icinga-dashboard/metadata.py @@ -0,0 +1,12 @@ +defaults = { + 'cron': { + 'simple-icinga-dashboard': '* * * * * icinga_dashboard cd /opt/simple-icinga-dashboard/src/ && ./service.py', + }, + 'postfix': { + 'aliases': { + 'icinga_dashboard': { + 'root', + }, + }, + }, +} diff --git a/data/powerdns/files/bind-zones/franzi.business b/data/powerdns/files/bind-zones/franzi.business index 8303089..65d1733 100644 --- a/data/powerdns/files/bind-zones/franzi.business +++ b/data/powerdns/files/bind-zones/franzi.business @@ -23,6 +23,9 @@ sewfile IN A 116.203.205.248 IN AAAA 2a01:4f8:c0c:c71b::1 IN TXT "v=spf1 a mx ~all" +status IN A 51.195.44.8 +status IN AAAA 2001:41d0:701:1100::2618 + travelynx IN A 94.130.52.224 travelynx IN AAAA 2a01:4f8:10b:2a5f::2 diff --git a/nodes/ovh/icinga2.py b/nodes/ovh/icinga2.py index 7f6f515..86722e2 100644 --- a/nodes/ovh/icinga2.py +++ b/nodes/ovh/icinga2.py @@ -4,6 +4,7 @@ nodes['ovh.icinga2'] = { 'iptables', 'php', 'postgresql', + 'simple-icinga-dashboard', 'wireguard', 'zfs', }, @@ -30,6 +31,13 @@ nodes['ovh.icinga2'] = { 'icinga2': { 'api_users': { # Used with + 'dashboard': { + 'password': vault.password_for('ovh.icinga2 icinga2 api_user dashboard'), + 'permissions': { + 'objects/query/Host', + 'objects/query/Service' + }, + }, 'icinga2beamer': { 'password': vault.decrypt('encrypt$gAAAAABf3wM9YS5ZpRdhp3xyIFX21_MK0omzqHqykWbWdkZWp2xyJ6awaUSXODnZQ5j-rws6n0yrpaeMdXoj1irb2FrgxMDTdfCh88hIsqcKGOObzwGaRg6Ze0tuiMrzIfOO3tRnc9Kd'), 'permissions': { @@ -80,7 +88,11 @@ nodes['ovh.icinga2'] = { 'target': 'http://127.0.0.1:5000/', } }, - } + }, + 'statuspage': { + 'domain': 'status.franzi.business', + 'webroot': '/opt/simple-icinga-dashboard/out', + }, }, }, 'php': { @@ -97,6 +109,13 @@ nodes['ovh.icinga2'] = { 'xml', }, }, + 'simple-icinga-dashboard': { + 'api_url': 'https://127.0.0.1:5665', + 'api_user': 'dashboard', + 'api_password': vault.password_for('ovh.icinga2 icinga2 api_user dashboard'), + 'host_filter': '"checks_with_sms" in host.groups', + 'service_filter': '"checks_with_sms" in service.groups' + }, 'wireguard': { 'my_ip': '172.19.137.3/32', 'peers': {