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