]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - systems/backup-2/monitoring.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / systems / backup-2 / monitoring.nix
1 { config, pkgs, lib, name, openldap, monitoring, ... }:
2 let
3 hostFQDN = config.hostEnv.fqdn;
4 emailCheck = monitoring.lib.emailCheck config.myEnv.monitoring.email_check;
5 in
6 {
7 config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "file_date" "mysql" "openldap" "redis" "emails" "notify-secondary"];
8 config.myServices.monitoring.objects = lib.mkMerge [
9 (monitoring.lib.objectsCommon {
10 inherit hostFQDN;
11 hostName = name;
12 master = false;
13 processWarn = "60"; processAlert = "70";
14 loadWarn = "4.0"; loadAlert = "6.0";
15 load15Warn = "1.0"; load15Alert = "1.0";
16 interface = builtins.head (builtins.attrNames config.networking.interfaces);
17 })
18
19 {
20 service = [
21 (emailCheck "backup-2" hostFQDN // {
22 __passive_servicegroups = "webstatus-email";
23 })
24 {
25 service_description = "Size on /backup2 partition";
26 use = "local-service";
27 check_command = ["check_local_disk" "10%" "5%" "/backup2"];
28 __passive_servicegroups = "webstatus-resources";
29 }
30 {
31 service_description = "Last backup in /backup2/phare is not too old";
32 use = "local-service";
33 check_command = ["check_last_file_date" "/backup2/phare" "14" "backup"];
34 __passive_servicegroups = "webstatus-backup";
35 }
36 {
37 service_description = "Last backup in /backup2/dilion is not too old";
38 use = "local-service";
39 check_command = ["check_last_file_date" "/backup2/dilion" "14" "backup"];
40 __passive_servicegroups = "webstatus-backup";
41 }
42 {
43 service_description = "Last backup in /backup2/ulminfo is not too old";
44 use = "local-service";
45 check_command = ["check_last_file_date" "/backup2/ulminfo" "14" "backup"];
46 __passive_servicegroups = "webstatus-backup";
47 }
48 {
49 service_description = "Last postgresql dump in /backup2/eldiron/postgresql_backup is not too old";
50 use = "local-service";
51 check_command = ["check_last_file_date" "/backup2/eldiron/postgresql_backup" "7" "postgres"];
52 __passive_servicegroups = "webstatus-databases,webstatus-backup";
53 }
54 {
55 service_description = "Redis replication for eldiron is up to date";
56 use = "local-service";
57 check_command = ["check_redis_replication" "/run/redis_eldiron/redis.sock"];
58 __passive_servicegroups = "webstatus-databases";
59 }
60 {
61 service_description = "Last redis dump in /backup2/eldiron/redis_backup is not too old";
62 use = "local-service";
63 check_command = ["check_last_file_date" "/backup2/eldiron/redis_backup" "7" "redis"];
64 __passive_servicegroups = "webstatus-databases,webstatus-backup";
65 }
66 {
67 service_description = "Mysql replication for eldiron is up to date";
68 use = "local-service";
69 check_command = ["check_mysql_replication" "/run/mysqld_eldiron/mysqld.sock" config.secrets.fullPaths."mysql_replication/eldiron/client"];
70 __passive_servicegroups = "webstatus-databases";
71 }
72 {
73 service_description = "Last mysql dump in /backup2/eldiron/mysql_backup is not too old";
74 use = "local-service";
75 check_command = ["check_last_file_date" "/backup2/eldiron/mysql_backup" "7" "mysql"];
76 __passive_servicegroups = "webstatus-databases,webstatus-backup";
77 }
78 {
79 service_description = "Openldap replication for eldiron is up to date";
80 use = "local-service";
81 check_command = let
82 name = "eldiron";
83 hcfg = config.myServices.databasesReplication.openldap.hosts.eldiron;
84 base = config.myServices.databasesReplication.openldap.base;
85 ldapConfig = pkgs.writeText "slapd.conf" ''
86 include ${pkgs.openldap}/etc/schema/core.schema
87 include ${pkgs.openldap}/etc/schema/cosine.schema
88 include ${pkgs.openldap}/etc/schema/inetorgperson.schema
89 include ${pkgs.openldap}/etc/schema/nis.schema
90 include ${openldap.immae-schema}
91 moduleload back_mdb
92 backend mdb
93 database mdb
94
95 suffix "${hcfg.base}"
96 directory ${base}/${name}/openldap
97 '';
98 in [
99 "check_openldap_replication"
100 hcfg.url
101 hcfg.dn
102 config.secrets.fullPaths."openldap_replication/eldiron/replication_password"
103 hcfg.base
104 "${ldapConfig}"
105 ];
106 __passive_servicegroups = "webstatus-databases";
107 }
108 {
109 service_description = "Last openldap dump in /backup2/eldiron/openldap_backup is not too old";
110 use = "local-service";
111 check_command = ["check_last_file_date" "/backup2/eldiron/openldap_backup" "7" "openldap"];
112 __passive_servicegroups = "webstatus-databases,webstatus-backup";
113 }
114 ];
115 }
116 ];
117 }