]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - private/monitoring/objects_backup-2.nix
Add tools
[perso/Immae/Config/Nix.git] / 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 include ${pkgs.openldap}/etc/schema/core.schema
83 include ${pkgs.openldap}/etc/schema/cosine.schema
84 include ${pkgs.openldap}/etc/schema/inetorgperson.schema
85 include ${pkgs.openldap}/etc/schema/nis.schema
86 ${eldiron_schemas}
87 moduleload back_hdb
88 backend hdb
89 database hdb
90
91 suffix "${hcfg.base}"
92 directory ${base}/${name}/openldap
93 '';
94 in [
95 "check_openldap_replication"
96 hcfg.url
97 hcfg.dn
98 "${config.secrets.location}/openldap_replication/eldiron/replication_password"
99 hcfg.base
100 ldapConfig
101 ];
102 }
103 {
104 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
105 service_description = "Last openldap dump in /backup2/eldiron/openldap_backup is not too old";
106 use = "local-service";
107 check_command = ["check_last_file_date" "/backup2/eldiron/openldap_backup" "7" "openldap"];
108 }
109 ];
110 }