From 0f7a0c3ac22886e14d7a854614eb5d2db11cbb51 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 18 Apr 2023 16:03:46 +0200 Subject: [PATCH] Add smartctl monitoring --- monitoring.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/monitoring.nix b/monitoring.nix index c2644eb..3190d06 100644 --- a/monitoring.nix +++ b/monitoring.nix @@ -21,6 +21,13 @@ metrics-addr = "127.0.0.1:9323"; }; + # Required to allow the smartctl exporter to read the nvme0 character device, + # see the commit message on: + # https://github.com/NixOS/nixpkgs/commit/12c26aca1fd55ab99f831bedc865a626eee39f80 + services.udev.extraRules = '' + SUBSYSTEM=="nvme", KERNEL=="nvme[0-9]*", GROUP="disk" + ''; + services.prometheus = { exporters = { @@ -32,6 +39,7 @@ enabledCollectors = [ "systemd" ]; port = 9002; }; + smartctl.enable = true; }; scrapeConfigs = [ @@ -43,6 +51,7 @@ "127.0.0.1:${toString config.services.prometheus.exporters.ipmi.port}" "127.0.0.1:9323" "127.0.0.1:9252" + "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}" ]; }]; }