]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - systems/eldiron/monitoring.nix
Migrate to borg backup
[perso/Immae/Config/Nix.git] / systems / eldiron / monitoring.nix
1 { config, pkgs, lib, name, 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.smartdDisks = [
8 "ata-ST33000650NS_Z29540DM"
9 "ata-ST33000650NS_Z296JGJ4"
10 "ata-Micron_5200_MTFDDAK480TDC_18011BEE03B3"
11 ];
12
13 config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "emails" "mdadm" "postfix" "postgresql" "zfs" "notify-secondary" "smartctl" ];
14 config.myServices.monitoring.pluginsArgs.postgresql.package = config.myServices.databases.postgresql.package;
15 config.myServices.monitoring.objects = lib.mkMerge [
16 (monitoring.lib.objectsCommon {
17 inherit hostFQDN;
18 hostName = name;
19 master = false;
20 processWarn = "550"; processAlert = "650";
21 loadWarn = "1.0"; loadAlert = "1.2";
22 interface = builtins.head (builtins.attrNames config.networking.interfaces);
23 })
24
25 {
26 service = [
27 {
28 service_description = "No mdadm array is degraded";
29 use = "local-service";
30 check_command = ["check_mdadm"];
31 __passive_servicegroups = "webstatus-resources";
32 }
33 {
34 service_description = "Postgresql replication for backup-2 is up to date";
35 use = "local-service";
36 check_command = ["check_postgresql_replication" "backup-2" "/run/postgresql" "5432"];
37 __passive_servicegroups = "webstatus-databases";
38 }
39 {
40 service_description = "No ZFS pool is degraded";
41 use = "local-service";
42 check_command = ["check_zfs"];
43 __passive_servicegroups = "webstatus-resources";
44 }
45 {
46 service_description = "mailq is empty";
47 use = "local-service";
48 check_command = ["check_mailq"];
49 __passive_servicegroups = "webstatus-email";
50 }
51 (emailCheck "eldiron" hostFQDN // {
52 __passive_servicegroups = "webstatus-email";
53 })
54 ];
55 }
56 ];
57 }