]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/monitoring/objects_monitoring-1.nix
Adjust monitoring resources and add bandwidth checks
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_monitoring-1.nix
index a46b684ebc3c25a1a406fd5a87b587bcffdece75..320f6e33fa7c4be2445ac9d2ac7653b560b38dc3 100644 (file)
@@ -1,4 +1,23 @@
-{ config, pkgs, ... }:
+{ config, pkgs, nodes, hostFQDN, emailCheck, ... }:
+let
+  to_eriomem_age_dependency = name: {
+    dependent_host_name = "eldiron.immae.eu";
+    host_name           = "eldiron.immae.eu";
+    dependent_service_description = "Eriomem backup for ${name} is not too old";
+    service_description = "Eriomem backup is up and not full";
+    execution_failure_criteria = "u";
+    notification_failure_criteria = "u";
+  };
+  to_eriomem_age = name: {
+    service_description = "Eriomem backup for ${name} is not too old";
+    host_name = "eldiron.immae.eu";
+    use = "external-service";
+    check_command = ["check_eriomem_age" name];
+
+    check_interval = "120";
+    notification_interval = "1440";
+  };
+in
 {
   host = {
     # Dummy host for testing
@@ -22,6 +41,8 @@
     #   check_command = "check_critical";
     # }
 
+    (emailCheck "monitoring-1" hostFQDN)
+
     {
       service_description = "ftp has access to database for authentication";
       host_name = "eldiron.immae.eu";
       _webstatus_url = "imap.immae.eu";
     }
 
+    # Third party services
+    {
+      service_description = "OVH account has enough sms";
+      host_name = "eldiron.immae.eu";
+      use = "external-service";
+      check_command = "check_ovh_sms";
+
+      check_interval = "120";
+      notification_interval = "1440";
+    }
+
+    # Backup services
+    {
+      service_description = "Eriomem backup is up and not full";
+      host_name = "eldiron.immae.eu";
+      use = "external-service";
+      check_command = "check_eriomem";
+
+      check_interval = "120";
+      notification_interval = "1440";
+
+      servicegroups = "webstatus-backup";
+    }
+
     # DNS services
     {
       service_description = "eldiron dns is active and authoritative for aten.pro";
       service_description = "roundcube website is running on mail.immae.eu";
       host_name = "eldiron.immae.eu";
       use = "external-web-service";
-      check_command = ["check_https_code" "mail.immae.eu" "/roundcube/" "401" "<title>Roundcube"];
+      check_command = ["check_https" "mail.immae.eu" "/roundcube/" "<title>Roundcube"];
 
       servicegroups = "webstatus-webapps,webstatus-email";
       _webstatus_name = "Roundcube";
       service_description = "Telio website is running on realistesmedia.fr";
       host_name = "eldiron.immae.eu";
       use = "external-web-service";
-      check_command = ["check_https" "realistesmedia.fr" "/" "<title>RĂ©al'istes"];
+      check_command = ["check_https" "realistesmedia.fr" "/" "doctype html"];
       contact_groups = "telio-tortay";
     }
 
       _webstatus_url = "https://www.sandetludo.com/";
     }
 
-    {
-      service_description = "Maison bbc accepts add requests on http";
-      host_name = "eldiron.immae.eu";
-      use = "external-web-service";
-      check_command = [ "check_http" "maison.bbc.bouya.org" "/add.php" "^$"];
-    }
-
-    {
-      service_description = "Maison bbc has up to date data";
-      host_name = "eldiron.immae.eu";
-      use = "generic-service";
-      contact_groups = "maison-bbc";
-      notification_interval = "1440";
-      check_command = "check_maison_bbc";
-      flap_detection_enabled = "0";
-      max_check_attempts = "1";
-    }
-
     # SSL
     {
       service_description = "ldap SSL is up to date";
       _webstatus_name = "LDAP";
       _webstatus_url = "ldap.immae.eu";
     }
-  ];
+  ] ++ map to_eriomem_age (builtins.attrNames nodes.eldiron.config.services.duplyBackup.profiles);
   contact = {
     telio-tortay = config.myEnv.monitoring.contacts.telio-tortay // {
       use = "generic-contact";
       contactgroups = "telio-tortay";
     };
-    papa = config.myEnv.monitoring.contacts.papa // {
-      use = "generic-contact";
-      contactgroups = "maison-bbc";
-      service_notification_commands = "notify-maison-bbc-by-email";
-    };
   };
   contactgroup = {
-    maison-bbc = { alias = "Maison BBC"; };
     telio-tortay = { alias = "Telio Tortay"; members = "immae"; };
   };
+  servicedependency = map to_eriomem_age_dependency (builtins.attrNames nodes.eldiron.config.services.duplyBackup.profiles);
 }