]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/monitoring/objects_backup-2.nix
Completely remove immae.eu
[perso/Immae/Config/Nix.git] / modules / private / monitoring / objects_backup-2.nix
CommitLineData
ef0a9217 1{ config, pkgs, lib, hostFQDN, emailCheck, ... }:
e820134d
IB
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 = [
ef0a9217
IB
15 (emailCheck "backup-2" hostFQDN // {
16 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-email"; freshness_threshold = "1350"; };
17 })
eb071dd4 18 {
e820134d 19 passiveInfo = defaultPassiveInfo;
eb071dd4
IB
20 service_description = "Size on /backup2 partition";
21 use = "local-service";
22 check_command = ["check_local_disk" "10%" "5%" "/backup2"];
23 }
24 {
e820134d 25 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
eb071dd4
IB
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 {
e820134d 31 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
a1a4a72e 32 service_description = "Last backup in /backup2/dilion is not too old";
eb071dd4 33 use = "local-service";
a1a4a72e 34 check_command = ["check_last_file_date" "/backup2/dilion" "14" "backup"];
eb071dd4
IB
35 }
36 {
e820134d 37 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; };
791d00e6 38 service_description = "Last backup in /backup2/ulminfo is not too old";
eb071dd4 39 use = "local-service";
791d00e6 40 check_command = ["check_last_file_date" "/backup2/ulminfo" "14" "backup"];
eb071dd4
IB
41 }
42 {
e820134d 43 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
eb071dd4
IB
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 }
6015a3b5 48 {
e820134d 49 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
6015a3b5
IB
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 {
e820134d 55 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
6015a3b5
IB
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 {
e820134d 61 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
6015a3b5
IB
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 }
9f6a7862 66 {
e820134d 67 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
9f6a7862
IB
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 }
16b80abd 72 {
e820134d 73 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
16b80abd
IB
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 {
e820134d 100 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
16b80abd
IB
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 }
eb071dd4
IB
105 ];
106}