]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/monitoring/objects_backup-2.nix
52289ddcbc4acc7780f4c39f93bb8729149d4a88
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_backup-2.nix
1 { config, pkgs, lib, hostFQDN, ... }:
2 let
3 defaultPassiveInfo = {
4 filter = lib.attrsets.filterAttrs
5 (k: v: builtins.elem k ["service_description"] || builtins.substring 0 1 k == "_");
6 use = "external-passive-service";
7 freshness_threshold = "450";
8 retry_interval = "1";
9 servicegroups = "webstatus-resources";
10 host_name = hostFQDN;
11 };
12 in
13 {
14 service = [
15 {
16 passiveInfo = defaultPassiveInfo;
17 service_description = "Size on /backup2 partition";
18 use = "local-service";
19 check_command = ["check_local_disk" "10%" "5%" "/backup2"];
20 }
21 {
22 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
23 service_description = "Last backup in /backup2/phare is not too old";
24 use = "local-service";
25 check_command = ["check_last_file_date" "/backup2/phare" "14" "backup"];
26 }
27 {
28 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
29 service_description = "Last backup in /backup2/immae_eu is not too old";
30 use = "local-service";
31 check_command = ["check_last_file_date" "/backup2/immae_eu" "14" "backup"];
32 }
33 {
34 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
35 service_description = "Last backup in /backup2/ulminfo is not too old";
36 use = "local-service";
37 check_command = ["check_last_file_date" "/backup2/ulminfo" "14" "backup"];
38 }
39 {
40 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
41 service_description = "Last postgresql dump in /backup2/eldiron/postgresql_backup is not too old";
42 use = "local-service";
43 check_command = ["check_last_file_date" "/backup2/eldiron/postgresql_backup" "7" "postgres"];
44 }
45 {
46 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
47 service_description = "Redis replication for eldiron is up to date";
48 use = "local-service";
49 check_command = ["check_redis_replication" "/run/redis_eldiron/redis.sock"];
50 }
51 {
52 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
53 service_description = "Last redis dump in /backup2/eldiron/redis_backup is not too old";
54 use = "local-service";
55 check_command = ["check_last_file_date" "/backup2/eldiron/redis_backup" "7" "redis"];
56 }
57 {
58 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
59 service_description = "Mysql replication for eldiron is up to date";
60 use = "local-service";
61 check_command = ["check_mysql_replication" "/run/mysqld_eldiron/mysqld.sock" "/var/secrets/mysql_replication/eldiron/client"];
62 }
63 {
64 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
65 service_description = "Last mysql dump in /backup2/eldiron/mysql_backup is not too old";
66 use = "local-service";
67 check_command = ["check_last_file_date" "/backup2/eldiron/mysql_backup" "7" "mysql"];
68 }
69 {
70 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
71 service_description = "Openldap replication for eldiron is up to date";
72 use = "local-service";
73 check_command = let
74 name = "eldiron";
75 hcfg = config.myServices.databasesReplication.openldap.hosts.eldiron;
76 base = config.myServices.databasesReplication.openldap.base;
77 eldiron_schemas = pkgs.callPackage ../databases/openldap/eldiron_schemas.nix {};
78 ldapConfig = pkgs.writeText "slapd.conf" ''
79 ${eldiron_schemas}
80 moduleload back_hdb
81 backend hdb
82 database hdb
83
84 suffix "${hcfg.base}"
85 directory ${base}/${name}/openldap
86 '';
87 in [
88 "check_openldap_replication"
89 hcfg.url
90 hcfg.dn
91 "${config.secrets.location}/openldap_replication/eldiron/replication_password"
92 hcfg.base
93 ldapConfig
94 ];
95 }
96 {
97 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
98 service_description = "Last openldap dump in /backup2/eldiron/openldap_backup is not too old";
99 use = "local-service";
100 check_command = ["check_last_file_date" "/backup2/eldiron/openldap_backup" "7" "openldap"];
101 }
102 ];
103 }