]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/monitoring/objects_backup-2.nix
Add openldap replication
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_backup-2.nix
1 { config, pkgs, ... }:
2 {
3 service = [
4 {
5 service_description = "Size on /backup2 partition";
6 use = "local-service";
7 check_command = ["check_local_disk" "10%" "5%" "/backup2"];
8 }
9 {
10 service_description = "Last backup in /backup2/phare is not too old";
11 use = "local-service";
12 check_command = ["check_last_file_date" "/backup2/phare" "14" "backup"];
13 }
14 {
15 service_description = "Last backup in /backup2/immae_eu is not too old";
16 use = "local-service";
17 check_command = ["check_last_file_date" "/backup2/immae_eu" "14" "backup"];
18 }
19 {
20 service_description = "Last backup in /backup2/immae_fr is not too old";
21 use = "local-service";
22 check_command = ["check_last_file_date" "/backup2/immae_fr" "14" "backup"];
23 }
24 {
25 service_description = "Last postgresql dump in /backup2/eldiron/postgresql_backup is not too old";
26 use = "local-service";
27 check_command = ["check_last_file_date" "/backup2/eldiron/postgresql_backup" "7" "postgres"];
28 }
29 {
30 service_description = "Redis replication for eldiron is up to date";
31 use = "local-service";
32 check_command = ["check_redis_replication" "/run/redis_eldiron/redis.sock"];
33 }
34 {
35 service_description = "Last redis dump in /backup2/eldiron/redis_backup is not too old";
36 use = "local-service";
37 check_command = ["check_last_file_date" "/backup2/eldiron/redis_backup" "7" "redis"];
38 }
39 {
40 service_description = "Mysql replication for eldiron is up to date";
41 use = "local-service";
42 check_command = ["check_mysql_replication" "/run/mysqld_eldiron/mysqld.sock" "/var/secrets/mysql_replication/eldiron/client"];
43 }
44 {
45 service_description = "Last mysql dump in /backup2/eldiron/mysql_backup is not too old";
46 use = "local-service";
47 check_command = ["check_last_file_date" "/backup2/eldiron/mysql_backup" "7" "mysql"];
48 }
49 {
50 service_description = "Openldap replication for eldiron is up to date";
51 use = "local-service";
52 check_command = let
53 name = "eldiron";
54 hcfg = config.myServices.databasesReplication.openldap.hosts.eldiron;
55 base = config.myServices.databasesReplication.openldap.base;
56 eldiron_schemas = pkgs.callPackage ../databases/openldap/eldiron_schemas.nix {};
57 ldapConfig = pkgs.writeText "slapd.conf" ''
58 ${eldiron_schemas}
59 moduleload back_hdb
60 backend hdb
61 database hdb
62
63 suffix "${hcfg.base}"
64 directory ${base}/${name}/openldap
65 '';
66 in [
67 "check_openldap_replication"
68 hcfg.url
69 hcfg.dn
70 "${config.secrets.location}/openldap_replication/eldiron/replication_password"
71 hcfg.base
72 ldapConfig
73 ];
74 }
75 {
76 service_description = "Last openldap dump in /backup2/eldiron/openldap_backup is not too old";
77 use = "local-service";
78 check_command = ["check_last_file_date" "/backup2/eldiron/openldap_backup" "7" "openldap"];
79 }
80 ];
81 }