]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/monitoring/objects_eldiron.nix
Refactor monitoring to avoid useless resources in each machine
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_eldiron.nix
index 897fc15f85d7389305042944e13d1cd7fcb26586..75e7b0eb84d6a81d98644a2328a3f414c5acc5fa 100644 (file)
@@ -1,15 +1,38 @@
-{ ... }:
+{ lib, hostFQDN, emailCheck, ... }:
+let
+  defaultPassiveInfo = {
+    filter = lib.attrsets.filterAttrs
+      (k: v: builtins.elem k ["service_description"] || builtins.substring 0 1 k == "_");
+    use = "external-passive-service";
+    freshness_threshold = "450";
+    retry_interval = "1";
+    servicegroups = "webstatus-resources";
+    host_name = hostFQDN;
+  };
+in
 {
+  activatedPlugins = [ "emails" "postgresql" "zfs" ];
   service = [
     {
+      passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
       service_description = "Postgresql replication for backup-2 is up to date";
       use = "local-service";
       check_command = ["check_postgresql_replication" "backup-2" "/run/postgresql" "5432"];
     }
     {
+      passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-resources"; };
+      service_description = "No ZFS pool is degraded";
+      use = "local-service";
+      check_command = ["check_zfs"];
+    }
+    {
+      passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-email"; };
       service_description = "mailq is empty";
       use = "local-service";
       check_command = ["check_mailq"];
     }
+    (emailCheck "eldiron" hostFQDN // {
+      passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-email"; freshness_threshold = "1350"; };
+    })
   ];
 }