diff options
Diffstat (limited to 'systems/eldiron/monitoring.nix')
-rw-r--r-- | systems/eldiron/monitoring.nix | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/systems/eldiron/monitoring.nix b/systems/eldiron/monitoring.nix new file mode 100644 index 0000000..2aa7f8f --- /dev/null +++ b/systems/eldiron/monitoring.nix | |||
@@ -0,0 +1,51 @@ | |||
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.activatedPlugins = [ "memory" "command" "bandwidth" "emails" "mdadm" "postfix" "postgresql" "zfs" "notify-secondary"]; | ||
8 | config.myServices.monitoring.pluginsArgs.postgresql.package = config.myServices.databases.postgresql.package; | ||
9 | config.myServices.monitoring.objects = lib.mkMerge [ | ||
10 | (monitoring.lib.objectsCommon { | ||
11 | inherit hostFQDN; | ||
12 | hostName = name; | ||
13 | master = false; | ||
14 | processWarn = "550"; processAlert = "650"; | ||
15 | loadWarn = "1.0"; loadAlert = "1.2"; | ||
16 | interface = builtins.head (builtins.attrNames config.networking.interfaces); | ||
17 | }) | ||
18 | |||
19 | { | ||
20 | service = [ | ||
21 | { | ||
22 | service_description = "No mdadm array is degraded"; | ||
23 | use = "local-service"; | ||
24 | check_command = ["check_mdadm"]; | ||
25 | __passive_servicegroups = "webstatus-resources"; | ||
26 | } | ||
27 | { | ||
28 | service_description = "Postgresql replication for backup-2 is up to date"; | ||
29 | use = "local-service"; | ||
30 | check_command = ["check_postgresql_replication" "backup-2" "/run/postgresql" "5432"]; | ||
31 | __passive_servicegroups = "webstatus-databases"; | ||
32 | } | ||
33 | { | ||
34 | service_description = "No ZFS pool is degraded"; | ||
35 | use = "local-service"; | ||
36 | check_command = ["check_zfs"]; | ||
37 | __passive_servicegroups = "webstatus-resources"; | ||
38 | } | ||
39 | { | ||
40 | service_description = "mailq is empty"; | ||
41 | use = "local-service"; | ||
42 | check_command = ["check_mailq"]; | ||
43 | __passive_servicegroups = "webstatus-email"; | ||
44 | } | ||
45 | (emailCheck "eldiron" hostFQDN // { | ||
46 | __passive_servicegroups = "webstatus-email"; | ||
47 | }) | ||
48 | ]; | ||
49 | } | ||
50 | ]; | ||
51 | } | ||