From 408ce9363bf574796487fedfe59a4a2ff0cbb4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 13 Apr 2024 12:39:31 +0200 Subject: Add monitoring script with smartctl --- systems/eldiron/flake.lock | 2 +- systems/eldiron/monitoring.nix | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'systems/eldiron') diff --git a/systems/eldiron/flake.lock b/systems/eldiron/flake.lock index f5b9184..461bebb 100644 --- a/systems/eldiron/flake.lock +++ b/systems/eldiron/flake.lock @@ -2038,7 +2038,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", + "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/eldiron/monitoring.nix b/systems/eldiron/monitoring.nix index 2aa7f8f..92da7cf 100644 --- a/systems/eldiron/monitoring.nix +++ b/systems/eldiron/monitoring.nix @@ -4,7 +4,7 @@ let emailCheck = monitoring.lib.emailCheck config.myEnv.monitoring.email_check; in { - config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "emails" "mdadm" "postfix" "postgresql" "zfs" "notify-secondary"]; + config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "emails" "mdadm" "postfix" "postgresql" "zfs" "notify-secondary" "smartctl" ]; config.myServices.monitoring.pluginsArgs.postgresql.package = config.myServices.databases.postgresql.package; config.myServices.monitoring.objects = lib.mkMerge [ (monitoring.lib.objectsCommon { @@ -18,6 +18,38 @@ in { service = [ + { + service_description = "Disk /dev/disk/by-id/ata-ST33000650NS_Z29540DM is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-ST33000650NS_Z29540DM" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } + { + service_description = "Disk /dev/disk/by-id/ata-ST33000650NS_Z296JGJ4 is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-ST33000650NS_Z296JGJ4" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } + { + service_description = "Disk /dev/disk/by-id/ata-SAMSUNG_MZ7LM480HMHQ-00005_S2UJNX0HA05895 is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-SAMSUNG_MZ7LM480HMHQ-00005_S2UJNX0HA05895" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } + { + service_description = "Disk /dev/disk/by-id/ata-Micron_5200_MTFDDAK480TDC_18011BEE03B3 is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-Micron_5200_MTFDDAK480TDC_18011BEE03B3" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } { service_description = "No mdadm array is degraded"; use = "local-service"; -- cgit v1.2.3