]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/monitoring/objects_monitoring-1.nix
Refactor monitoring to avoid useless resources in each machine
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_monitoring-1.nix
index fdee81140ecbfd6ae4157daf01da450f717c7ede..32dbe4b9cd758b340f3bd13903cd587a4fd606ab 100644 (file)
@@ -1,5 +1,6 @@
 { config, pkgs, nodes, hostFQDN, emailCheck, lib, ... }:
 let
+  to_resource = func: cfg: lib.flatten (lib.optionals cfg.enable (lib.mapAttrsToList func cfg.profiles));
   to_backup_age_dependency = name: profile: map (remote:
     {
       dependent_host_name = "eldiron.immae.eu";
@@ -21,6 +22,7 @@ let
     }) profile.remotes;
 in
 {
+  activatedPlugins = [ "dns" "ftp" "git" "http" "imap" "ovh" "tcp" ];
   host = {
     # Dummy host for testing
     # "dummy-host" = {
@@ -112,17 +114,17 @@ in
     }
 
     # Backup services
-    {
-      service_description = "eriomem backup is up and not full";
-      host_name = "eldiron.immae.eu";
-      use = "external-service";
-      check_command = "check_backup_eriomem";
+    {
+      service_description = "eriomem backup is up and not full";
+      host_name = "eldiron.immae.eu";
+      use = "external-service";
+      check_command = "check_backup_eriomem";
 
-      check_interval = "120";
-      notification_interval = "1440";
+      check_interval = "120";
+      notification_interval = "1440";
 
-      servicegroups = "webstatus-backup";
-    }
+      servicegroups = "webstatus-backup";
+    }
     {
       service_description = "ovh backup is up and not full";
       host_name = "eldiron.immae.eu";
@@ -494,7 +496,7 @@ in
       service_description = "gitweb website is running on git.immae.eu";
       host_name = "eldiron.immae.eu";
       use = "external-web-service";
-      check_command = ["check_https" "git.immae.eu" "/" "git web interface"];
+      check_command = ["check_https" "git.immae.eu" "/cgit" "<title>Immae’s git"];
 
       servicegroups = "webstatus-webapps";
       _webstatus_name = "Git";
@@ -694,8 +696,18 @@ in
       use = "external-web-service";
       contact_groups = "tiboqorl";
       check_command = [ "check_https" "sc.groupe-cyllene.com" "/" "<title>Support Client Cyllene" ];
+      _webstatus_namespace = "tiboqorl";
+    }
+
+    {
+      service_description = "Origny page is running";
+      host_name = "tiboqorl.fr";
+      use = "external-web-service";
+      contact_groups = "tiboqorl";
+      check_command = [ "check_https" "origny.tiboqorl.fr" "/" "<title>Home Assistant" ];
+      _webstatus_namespace = "tiboqorl";
     }
-  ] ++ lib.flatten (lib.mapAttrsToList to_backup_age nodes.eldiron.config.services.duplyBackup.profiles);
+  ] ++ to_resource to_backup_age nodes.eldiron.config.services.duplyBackup;
   contact = {
     telio-tortay = config.myEnv.monitoring.contacts.telio-tortay // {
       use = "generic-contact";
@@ -710,5 +722,5 @@ in
     telio-tortay = { alias = "Telio Tortay"; members = "immae"; };
     tiboqorl = { alias = "Tiboqorl"; members = "immae"; };
   };
-  servicedependency = lib.flatten (lib.mapAttrsToList to_backup_age_dependency nodes.eldiron.config.services.duplyBackup.profiles);
+  servicedependency = to_resource to_backup_age_dependency nodes.eldiron.config.services.duplyBackup;
 }