From 912d58b8eeaca707577fc44f88faa7295f8c6133 Mon Sep 17 00:00:00 2001 From: Paul-Henri Froidmont Date: Fri, 9 Sep 2022 04:53:16 +0200 Subject: [PATCH] Watch raid status with Monit --- modules/custom-monit.nix | 5 +++-- profiles/storage.nix | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/custom-monit.nix b/modules/custom-monit.nix index c6c54a0..1578574 100644 --- a/modules/custom-monit.nix +++ b/modules/custom-monit.nix @@ -38,11 +38,11 @@ in include ${config.sops.secrets.monitMailserverConfig.path} set mail-format { from: monit@banditlair.com } - set alert alerts@banditlair.com + set alert alerts@banditlair.com with reminder on 120 cycles check system $HOST if cpu usage > 95% for 10 cycles then alert - if memory usage > 75% then alert + if memory usage > 75% for 5 times within 15 cycles then alert if swap usage > 25% then alert check filesystem root with path / @@ -50,6 +50,7 @@ in check file daily-backup-done with path /nix/var/data/backup/backup-ok if changed timestamp then alert + if timestamp > 26 hours then alert ${cfg.additionalConfig} ''; diff --git a/profiles/storage.nix b/profiles/storage.nix index 066ab71..497bd10 100644 --- a/profiles/storage.nix +++ b/profiles/storage.nix @@ -64,6 +64,9 @@ if failed port 443 protocol https with timeout 20 seconds then alert check host webmail with address webmail.banditlair.com if failed port 443 protocol https with timeout 20 seconds then alert + + check program raid-md127 with path "${pkgs.mdadm}/bin/mdadm --misc --detail --test /dev/md127" + if status != 0 then alert ''; services.minecraft-server = {