diff options
Diffstat (limited to 'systems/dilion/monitoring.nix')
-rw-r--r-- | systems/dilion/monitoring.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/systems/dilion/monitoring.nix b/systems/dilion/monitoring.nix new file mode 100644 index 0000000..af7f224 --- /dev/null +++ b/systems/dilion/monitoring.nix | |||
@@ -0,0 +1,43 @@ | |||
1 | { lib, pkgs, config, name, monitoring, ... }: | ||
2 | let | ||
3 | hostFQDN = config.hostEnv.fqdn; | ||
4 | zfs_snapshot = name: { | ||
5 | service_description = "ZFS snapshot ${name} happened not too long ago"; | ||
6 | use = "local-service"; | ||
7 | check_command = ["check_zfs_snapshot" name]; | ||
8 | __passive_servicegroups = "webstatus-resources"; | ||
9 | }; | ||
10 | in | ||
11 | { | ||
12 | config.myServices.monitoring.activatedPlugins = [ "memory" "command" "bandwidth" "mdadm" "zfs" "notify-secondary"]; | ||
13 | config.myServices.monitoring.objects = lib.mkMerge [ | ||
14 | (monitoring.lib.objectsCommon { | ||
15 | inherit hostFQDN; | ||
16 | hostName = name; | ||
17 | master = false; | ||
18 | processWarn = "250"; processAlert = "400"; | ||
19 | loadWarn = "1.0"; loadAlert = "1.2"; | ||
20 | interface = builtins.head (builtins.attrNames config.networking.interfaces); | ||
21 | }) | ||
22 | |||
23 | { | ||
24 | service = [ | ||
25 | { | ||
26 | service_description = "No mdadm array is degraded"; | ||
27 | use = "local-service"; | ||
28 | check_command = ["check_mdadm"]; | ||
29 | __passive_servicegroups = "webstatus-resources"; | ||
30 | } | ||
31 | { | ||
32 | service_description = "No ZFS pool is degraded"; | ||
33 | use = "local-service"; | ||
34 | check_command = ["check_zfs"]; | ||
35 | __passive_servicegroups = "webstatus-resources"; | ||
36 | } | ||
37 | (zfs_snapshot "zpool/backup/eldiron/zpool/root") | ||
38 | (zfs_snapshot "zpool/backup/eldiron/zpool/root/etc") | ||
39 | (zfs_snapshot "zpool/backup/eldiron/zpool/root/var") | ||
40 | ]; | ||
41 | } | ||
42 | ]; | ||
43 | } | ||