]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/monitoring/objects_backup-2.nix
Add openldap replication
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_backup-2.nix
index fad67630f693256b728df21610524625cb599106..2b80eee96f4643fbe836ccdc6aa7b48f917acb91 100644 (file)
@@ -1,4 +1,4 @@
-{ ... }:
+{ config, pkgs, ... }:
 {
   service = [
     {
       use = "local-service";
       check_command = ["check_last_file_date" "/backup2/eldiron/postgresql_backup" "7" "postgres"];
     }
+    {
+      service_description = "Redis replication for eldiron is up to date";
+      use = "local-service";
+      check_command = ["check_redis_replication" "/run/redis_eldiron/redis.sock"];
+    }
+    {
+      service_description = "Last redis dump in /backup2/eldiron/redis_backup is not too old";
+      use = "local-service";
+      check_command = ["check_last_file_date" "/backup2/eldiron/redis_backup" "7" "redis"];
+    }
+    {
+      service_description = "Mysql replication for eldiron is up to date";
+      use = "local-service";
+      check_command = ["check_mysql_replication" "/run/mysqld_eldiron/mysqld.sock" "/var/secrets/mysql_replication/eldiron/client"];
+    }
     {
       service_description = "Last mysql dump in /backup2/eldiron/mysql_backup is not too old";
       use = "local-service";
       check_command = ["check_last_file_date" "/backup2/eldiron/mysql_backup" "7" "mysql"];
     }
+    {
+      service_description = "Openldap replication for eldiron is up to date";
+      use = "local-service";
+      check_command = let
+        name = "eldiron";
+        hcfg = config.myServices.databasesReplication.openldap.hosts.eldiron;
+        base = config.myServices.databasesReplication.openldap.base;
+        eldiron_schemas = pkgs.callPackage ../databases/openldap/eldiron_schemas.nix {};
+        ldapConfig = pkgs.writeText "slapd.conf" ''
+          ${eldiron_schemas}
+          moduleload  back_hdb
+          backend     hdb
+          database    hdb
+
+          suffix    "${hcfg.base}"
+          directory ${base}/${name}/openldap
+          '';
+      in [
+        "check_openldap_replication"
+        hcfg.url
+        hcfg.dn
+        "${config.secrets.location}/openldap_replication/eldiron/replication_password"
+        hcfg.base
+        ldapConfig
+      ];
+    }
+    {
+      service_description = "Last openldap dump in /backup2/eldiron/openldap_backup is not too old";
+      use = "local-service";
+      check_command = ["check_last_file_date" "/backup2/eldiron/openldap_backup" "7" "openldap"];
+    }
   ];
 }