]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/monitoring/objects_backup-2.nix
Add monitoring host
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_backup-2.nix
CommitLineData
e820134d
IB
1{ config, pkgs, lib, hostFQDN, ... }:
2let
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 };
12in
eb071dd4
IB
13{
14 service = [
15 {
e820134d 16 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
17 service_description = "Size on /backup2 partition";
18 use = "local-service";
19 check_command = ["check_local_disk" "10%" "5%" "/backup2"];
20 }
21 {
e820134d 22 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
eb071dd4
IB
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 {
e820134d 28 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
eb071dd4
IB
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 {
e820134d 34 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
791d00e6 35 service_description = "Last backup in /backup2/ulminfo is not too old";
eb071dd4 36 use = "local-service";
791d00e6 37 check_command = ["check_last_file_date" "/backup2/ulminfo" "14" "backup"];
eb071dd4
IB
38 }
39 {
e820134d 40 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
eb071dd4
IB
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 }
6015a3b5 45 {
e820134d 46 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
6015a3b5
IB
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 {
e820134d 52 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
6015a3b5
IB
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 {
e820134d 58 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
6015a3b5
IB
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 }
9f6a7862 63 {
e820134d 64 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
9f6a7862
IB
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 }
16b80abd 69 {
e820134d 70 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
16b80abd
IB
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 {
e820134d 97 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
16b80abd
IB
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 }
eb071dd4
IB
102 ];
103}