@cryptotaxi247 / infra / commits / b48953bd

prometheus: alert on full zfs pool

Martin Weinelt committed Jan 12, 2025 at 03:12 UTC b48953bd1f71d94baf8afa124b91cd1b5437c05e
1 file changed +27
build/pluto/prometheus/exporters/zfs.nix
+27
@@ -1,3 +1,7 @@
1 +{
2 + pkgs,
3 + ...
4 +}:
5 {
6 services.prometheus = {
7 scrapeConfigs = [
@@ -14,5 +18,28 @@
18 ];
19 }
20 ];
21 + ruleFiles = [
22 + (pkgs.writeText "node-exporter.rules" (
23 + builtins.toJSON {
24 + groups = [
25 + {
26 + name = "zfs";
27 + rules = [
28 + {
29 + alert = "ZfsPoolFull";
30 + expr = ''
31 + (zfs_pool_free_bytes / zfs_pool_size_bytes) * 100 < 15
32 + '';
33 + for = "30m";
34 + labels.severity = "warning";
35 + annotations.summary = "ZFS pool {{ $labels.pool }} on {{ $labels.instance }} has only {{ $value }}% free space.";
36 + annotations.grafana = "https://grafana.nixos.org/d/rYdddlPWk/node-exporter-full?orgId=1&var-job=node&var-node={{ $labels.instance }}";
37 + }
38 + ];
39 + }
40 + ];
41 + }
42 + ))
43 + ];
44 };
45 }