From ee99bd561bcb5cb0d8f18c5290840280018c35db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 28 Dec 2024 15:18:44 +0100 Subject: Add docker monitoring --- deploy/flake.lock | 24 +++++------ flake.lock | 24 +++++------ flakes/flake.lock | 22 +++++----- flakes/private/monitoring/myplugins.nix | 9 +++++ systems/backup-2/flake.lock | 2 +- systems/dilion/flake.lock | 2 +- systems/eldiron/flake.lock | 2 +- systems/monitoring-1/flake.lock | 2 +- systems/monitoring-1/monitoring-master.nix | 4 ++ systems/monitoring-1/monitoring/Dockerfile | 35 ++++++++++++++++ systems/monitoring-1/monitoring/docker-compose.yml | 15 +++++++ systems/monitoring-1/monitoring/env.example | 5 +++ systems/monitoring-1/monitoring/run.sh | 47 ++++++++++++++++++++++ systems/quatresaisons/flake.lock | 2 +- 14 files changed, 155 insertions(+), 40 deletions(-) create mode 100644 systems/monitoring-1/monitoring/Dockerfile create mode 100644 systems/monitoring-1/monitoring/docker-compose.yml create mode 100644 systems/monitoring-1/monitoring/env.example create mode 100644 systems/monitoring-1/monitoring/run.sh diff --git a/deploy/flake.lock b/deploy/flake.lock index 73a5133..b7752d6 100644 --- a/deploy/flake.lock +++ b/deploy/flake.lock @@ -2848,7 +2848,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-d1iovH1gC8LTiZn5mCbkdjHRofv6828zpPS0bcZz/Ec=", + "narHash": "sha256-T9X0wbPED2Hk7lF7qb+3EtWcgfuzZiqHy5m2sSa4g8w=", "path": "../flakes", "type": "path" }, @@ -2959,7 +2959,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -2977,7 +2977,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -2995,7 +2995,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -3013,7 +3013,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -3898,7 +3898,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-0vnHkdR8S1iOAjNl4pQx/Tehv43IfkTw30momDbDWyE=", + "narHash": "sha256-aax6Z1sVT/lrE2m8m3jBqARvTeWIAYH/uREB4rsG8DE=", "path": "../systems/backup-2", "type": "path" }, @@ -3921,7 +3921,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-yvKk12foLp674+D3Px375wKXwNLzyDZACcFKGfuXbyA=", + "narHash": "sha256-6wAjFkH4EorMqgc191UHi229tVyBYC12rgMZycl7z+I=", "path": "../systems/dilion", "type": "path" }, @@ -3970,7 +3970,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-wSzIBw/JAmFJZbbwgTFblmQA/ih9V76fBNA3W1BXJWY=", + "narHash": "sha256-YKt1XSuZA8YlbwmjMXxxaDLFrTRIg59n27zTfL6PaYI=", "path": "../systems/eldiron", "type": "path" }, @@ -3996,7 +3996,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-lkrE2Y9Ya5oP8SLmmmljozrO+0pEfByhGVbQ4XalfjM=", + "narHash": "sha256-198sk6NzIod5HiYb7TR7yn8g3DY7hkh6c+IDn+U58AA=", "path": "../systems/monitoring-1", "type": "path" }, @@ -4021,7 +4021,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-lxvsI72fuXV7Br9GU0FmP0L9AG9R7MFSEQJFRK8lwMk=", + "narHash": "sha256-LFk9TW3iRxWsxtITf7PqlqeJ9S5JkBB41R46eVydnN8=", "path": "../systems/quatresaisons", "type": "path" }, @@ -7641,7 +7641,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -8528,7 +8528,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "./private/monitoring", "type": "path" }, diff --git a/flake.lock b/flake.lock index 14dd7cb..2f4897f 100644 --- a/flake.lock +++ b/flake.lock @@ -2729,7 +2729,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-d1iovH1gC8LTiZn5mCbkdjHRofv6828zpPS0bcZz/Ec=", + "narHash": "sha256-T9X0wbPED2Hk7lF7qb+3EtWcgfuzZiqHy5m2sSa4g8w=", "path": "./flakes", "type": "path" }, @@ -2975,7 +2975,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -2993,7 +2993,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -3011,7 +3011,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -3029,7 +3029,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -3914,7 +3914,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-0vnHkdR8S1iOAjNl4pQx/Tehv43IfkTw30momDbDWyE=", + "narHash": "sha256-aax6Z1sVT/lrE2m8m3jBqARvTeWIAYH/uREB4rsG8DE=", "path": "../systems/backup-2", "type": "path" }, @@ -3937,7 +3937,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-yvKk12foLp674+D3Px375wKXwNLzyDZACcFKGfuXbyA=", + "narHash": "sha256-6wAjFkH4EorMqgc191UHi229tVyBYC12rgMZycl7z+I=", "path": "../systems/dilion", "type": "path" }, @@ -3986,7 +3986,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-wSzIBw/JAmFJZbbwgTFblmQA/ih9V76fBNA3W1BXJWY=", + "narHash": "sha256-YKt1XSuZA8YlbwmjMXxxaDLFrTRIg59n27zTfL6PaYI=", "path": "../systems/eldiron", "type": "path" }, @@ -4012,7 +4012,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-lkrE2Y9Ya5oP8SLmmmljozrO+0pEfByhGVbQ4XalfjM=", + "narHash": "sha256-198sk6NzIod5HiYb7TR7yn8g3DY7hkh6c+IDn+U58AA=", "path": "../systems/monitoring-1", "type": "path" }, @@ -4037,7 +4037,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-lxvsI72fuXV7Br9GU0FmP0L9AG9R7MFSEQJFRK8lwMk=", + "narHash": "sha256-LFk9TW3iRxWsxtITf7PqlqeJ9S5JkBB41R46eVydnN8=", "path": "../systems/quatresaisons", "type": "path" }, @@ -7657,7 +7657,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -8544,7 +8544,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "./private/monitoring", "type": "path" }, diff --git a/flakes/flake.lock b/flakes/flake.lock index f4ef8ce..8bb078a 100644 --- a/flakes/flake.lock +++ b/flakes/flake.lock @@ -2879,7 +2879,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -2897,7 +2897,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -2915,7 +2915,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -2933,7 +2933,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -3818,7 +3818,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-0vnHkdR8S1iOAjNl4pQx/Tehv43IfkTw30momDbDWyE=", + "narHash": "sha256-aax6Z1sVT/lrE2m8m3jBqARvTeWIAYH/uREB4rsG8DE=", "path": "../systems/backup-2", "type": "path" }, @@ -3841,7 +3841,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-yvKk12foLp674+D3Px375wKXwNLzyDZACcFKGfuXbyA=", + "narHash": "sha256-6wAjFkH4EorMqgc191UHi229tVyBYC12rgMZycl7z+I=", "path": "../systems/dilion", "type": "path" }, @@ -3890,7 +3890,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-wSzIBw/JAmFJZbbwgTFblmQA/ih9V76fBNA3W1BXJWY=", + "narHash": "sha256-YKt1XSuZA8YlbwmjMXxxaDLFrTRIg59n27zTfL6PaYI=", "path": "../systems/eldiron", "type": "path" }, @@ -3916,7 +3916,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-lkrE2Y9Ya5oP8SLmmmljozrO+0pEfByhGVbQ4XalfjM=", + "narHash": "sha256-198sk6NzIod5HiYb7TR7yn8g3DY7hkh6c+IDn+U58AA=", "path": "../systems/monitoring-1", "type": "path" }, @@ -3941,7 +3941,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-lxvsI72fuXV7Br9GU0FmP0L9AG9R7MFSEQJFRK8lwMk=", + "narHash": "sha256-LFk9TW3iRxWsxtITf7PqlqeJ9S5JkBB41R46eVydnN8=", "path": "../systems/quatresaisons", "type": "path" }, @@ -7483,7 +7483,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, @@ -8410,7 +8410,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "./private/monitoring", "type": "path" }, diff --git a/flakes/private/monitoring/myplugins.nix b/flakes/private/monitoring/myplugins.nix index bb3a383..eb2fbd1 100644 --- a/flakes/private/monitoring/myplugins.nix +++ b/flakes/private/monitoring/myplugins.nix @@ -3,6 +3,9 @@ let cfg = config.myServices.monitoring; in { + base = { + debianPackages = [ "perl" "naemon-core" ]; + }; notify-secondary = { resources = { USER200 = config.myEnv.monitoring.status_url; @@ -18,6 +21,8 @@ in pkgs.curl pkgs.jq ]} ''; + debianScript = "${./plugins}/send_nrdp.sh"; + debianPackages = [ "curl" "jq" ]; }; notify-primary = { resources = { @@ -53,6 +58,8 @@ in pkgs.iproute pkgs.bc ]} ''; + debianScript = "${./plugins}/check_bandwidth"; + debianPackages = [ "bc" "iproute2" ]; }; command = { commands = { @@ -283,6 +290,8 @@ in pkgs.gnugrep pkgs.gawk pkgs.procps ]} ''; + debianScript = "${./plugins}/check_mem.sh"; + debianPackages = [ "grep" "mawk" "procps" ]; }; smartctl = { commands = { diff --git a/systems/backup-2/flake.lock b/systems/backup-2/flake.lock index c2a087b..5a21b51 100644 --- a/systems/backup-2/flake.lock +++ b/systems/backup-2/flake.lock @@ -417,7 +417,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/dilion/flake.lock b/systems/dilion/flake.lock index 0156cab..c55de32 100644 --- a/systems/dilion/flake.lock +++ b/systems/dilion/flake.lock @@ -207,7 +207,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/eldiron/flake.lock b/systems/eldiron/flake.lock index 8392aa7..52b9d03 100644 --- a/systems/eldiron/flake.lock +++ b/systems/eldiron/flake.lock @@ -2066,7 +2066,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/monitoring-1/flake.lock b/systems/monitoring-1/flake.lock index eb2e4a9..5685340 100644 --- a/systems/monitoring-1/flake.lock +++ b/systems/monitoring-1/flake.lock @@ -277,7 +277,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/monitoring-1/monitoring-master.nix b/systems/monitoring-1/monitoring-master.nix index e9362d9..6981672 100644 --- a/systems/monitoring-1/monitoring-master.nix +++ b/systems/monitoring-1/monitoring-master.nix @@ -66,6 +66,10 @@ in $USER201$=@@TOKEN@@ ''; }; + "=/common/.env.example".alias = ./monitoring/env.example; + "=/common/docker-compose.yml".alias = ./monitoring/docker-compose.yml; + "=/common/Dockerfile".alias = ./monitoring/Dockerfile; + "=/common/run.sh".alias = ./monitoring/run.sh; }; }; diff --git a/systems/monitoring-1/monitoring/Dockerfile b/systems/monitoring-1/monitoring/Dockerfile new file mode 100644 index 0000000..4bbf01b --- /dev/null +++ b/systems/monitoring-1/monitoring/Dockerfile @@ -0,0 +1,35 @@ +FROM debian:bookworm + +ARG namespace + +RUN \ + apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + gnupg + +RUN \ + curl -s "https://build.opensuse.org/projects/home:naemon/signing_keys/download?kind=gpg" | gpg --dearmor > /usr/share/keyrings/naemon.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/naemon.gpg] https://download.opensuse.org/repositories/home:/naemon/Debian_12/ ./" >> /etc/apt/sources.list.d/naemon-stable.list + +# Install the baseline packages for this image. Note, these +# packages are not version controlled and may change between +# builds. +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive \ + # La liste des packages debian à installer est directement fournie par Immae + apt-get install -y $(curl https://status.immae.eu/$namespace/debian-packages) + +# Perform the data directory initialization +RUN mkdir -p /data/var/log/naemon \ + && rm -rf /var/log/naemon \ + && ln -s /data/var/log/naemon /var/log/naemon \ + && find /etc/naemon -type f -not -name "naemon.cfg" -delete + +# Add the bootstrap script +RUN curl https://status.immae.eu/common/run.sh > /run.sh +RUN chmod 755 /run.sh + +# All data is stored on the root data volme +VOLUME ["/data"] + +ENTRYPOINT ["/run.sh"] diff --git a/systems/monitoring-1/monitoring/docker-compose.yml b/systems/monitoring-1/monitoring/docker-compose.yml new file mode 100644 index 0000000..b369463 --- /dev/null +++ b/systems/monitoring-1/monitoring/docker-compose.yml @@ -0,0 +1,15 @@ +services: + naemon: + build: + context: https://status.immae.eu/common/Dockerfile + args: + - namespace=${NAMESPACE} + container_name: naemon + restart: unless-stopped + environment: + - NOTIFY_REMOTE_TOKEN=${NOTIFY_REMOTE_TOKEN} + - NAMESPACE=${NAMESPACE} + pid: host + network_mode: host + volumes: + - ./data/log:/data/var/log/naemon diff --git a/systems/monitoring-1/monitoring/env.example b/systems/monitoring-1/monitoring/env.example new file mode 100644 index 0000000..bace5a5 --- /dev/null +++ b/systems/monitoring-1/monitoring/env.example @@ -0,0 +1,5 @@ +# Les deux variables ci-dessous sont à demander à Immae +# Token pour notifier le serveur distant (immae) +NOTIFY_REMOTE_TOKEN= +# Namespace sur immae.eu +NAMESPACE= diff --git a/systems/monitoring-1/monitoring/run.sh b/systems/monitoring-1/monitoring/run.sh new file mode 100644 index 0000000..9a57990 --- /dev/null +++ b/systems/monitoring-1/monitoring/run.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +function graceful_exit(){ + # Note, "service naemon stop" does not work in the phusion image + # We just kill the process rather than chase this down. + pkill naemon + exit $1 +} + +# Recup fichiers Ismael +if [ -n "$NAMESPACE" ]; then + echo "Namespace: $NAMESPACE" +else + echo "Le namespace n'a pas été défini dans \$NAMESPACE." + exit 1 +fi + +curl -o /etc/naemon/conf.d/objects.cfg "https://status.immae.eu/$NAMESPACE/objects.conf" +curl -o /etc/naemon/module-conf.d/immae.cfg "https://status.immae.eu/common/immae.cfg" +curl -o /etc/naemon/resource.cfg "https://status.immae.eu/common/resource.cfg" + +curl "https://status.immae.eu/$NAMESPACE/plugins.tar" | tar -C /etc/naemon -x + +sed -i -e "s|@@COMMON_PLUGINS@@|/usr/lib/naemon/plugins|" \ + -e "s|@@IMMAE_PLUGINS@@|/etc/naemon/immae_plugins/|" \ + -e "s|@@TOKEN@@|$NOTIFY_REMOTE_TOKEN|" \ + /etc/naemon/resource.cfg + +# Ensure consistent ownership for the data volume, even if the +# UID/GID's changes +chown -R naemon:naemon /etc/naemon /data/var/log/naemon + +# Start the services +service naemon start + +# Trap exit signals and do a proper shutdown +trap "graceful_exit 0;" SIGINT SIGTERM + +sleep 5 +while true +do + if ! [ -d "/proc/$(cat /var/run/naemon/naemon.pid)" ]; then + echo "Naemon no longer running" + graceful_exit 1 + fi + sleep 1 +done diff --git a/systems/quatresaisons/flake.lock b/systems/quatresaisons/flake.lock index 6aab914..55bb07d 100644 --- a/systems/quatresaisons/flake.lock +++ b/systems/quatresaisons/flake.lock @@ -239,7 +239,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-hkZiW8Nyd9pNIXhV/AQaJZQ1peOvTBMD8zjEtSAkh3E=", + "narHash": "sha256-d2Qc6vQHwjxXQqM76iLVNMFFux1HUZcpGZ8A8hPkYlE=", "path": "../../flakes/private/monitoring", "type": "path" }, -- cgit v1.2.3