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/backup-2/flake.lock | 2 +- systems/dilion/flake.lock | 2 +- systems/dilion/monitoring.nix | 34 +++++++++++++++++++++++++++++++++- systems/eldiron/flake.lock | 2 +- systems/eldiron/monitoring.nix | 34 +++++++++++++++++++++++++++++++++- systems/monitoring-1/flake.lock | 2 +- systems/quatresaisons/flake.lock | 2 +- 7 files changed, 71 insertions(+), 7 deletions(-) (limited to 'systems') diff --git a/systems/backup-2/flake.lock b/systems/backup-2/flake.lock index a8d55bf..d6e56a5 100644 --- a/systems/backup-2/flake.lock +++ b/systems/backup-2/flake.lock @@ -389,7 +389,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", + "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/dilion/flake.lock b/systems/dilion/flake.lock index 3096384..a690504 100644 --- a/systems/dilion/flake.lock +++ b/systems/dilion/flake.lock @@ -207,7 +207,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", + "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/dilion/monitoring.nix b/systems/dilion/monitoring.nix index af7f224..5c4e5b0 100644 --- a/systems/dilion/monitoring.nix +++ b/systems/dilion/monitoring.nix @@ -9,7 +9,7 @@ let }; in { - config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "mdadm" "zfs" "notify-secondary"]; + config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "mdadm" "zfs" "notify-secondary" "smartctl" ]; config.myServices.monitoring.objects = lib.mkMerge [ (monitoring.lib.objectsCommon { inherit hostFQDN; @@ -22,6 +22,38 @@ in { service = [ + { + service_description = "Disk /dev/disk/by-id/ata-Micron_1100_MTFDDAK512TBN_171216BD2A4B is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-Micron_1100_MTFDDAK512TBN_171216BD2A4B" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } + { + service_description = "Disk /dev/disk/by-id/ata-Micron_1100_MTFDDAK512TBN_171216BD2A70 is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-Micron_1100_MTFDDAK512TBN_171216BD2A70" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } + { + service_description = "Disk /dev/disk/by-id/ata-TOSHIBA_MG04ACA400N_96K1K87YFVLC is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-TOSHIBA_MG04ACA400N_96K1K87YFVLC" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } + { + service_description = "Disk /dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B2_WD-WMC1F0E4X6WP is sane"; + use = "local-service"; + check_command = [ "check_smartctl" "/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B2_WD-WMC1F0E4X6WP" ]; + __passive_servicegroups = "webstatus-resources"; + + check_interval = 60; + } { service_description = "No mdadm array is degraded"; use = "local-service"; 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"; diff --git a/systems/monitoring-1/flake.lock b/systems/monitoring-1/flake.lock index ed711f4..643683a 100644 --- a/systems/monitoring-1/flake.lock +++ b/systems/monitoring-1/flake.lock @@ -277,7 +277,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", + "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", "path": "../../flakes/private/monitoring", "type": "path" }, diff --git a/systems/quatresaisons/flake.lock b/systems/quatresaisons/flake.lock index a76103c..afb007b 100644 --- a/systems/quatresaisons/flake.lock +++ b/systems/quatresaisons/flake.lock @@ -239,7 +239,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", + "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", "path": "../../flakes/private/monitoring", "type": "path" }, -- cgit v1.2.3