diff options
Diffstat (limited to 'modules/collectors.nix')
| -rw-r--r-- | modules/collectors.nix | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/modules/collectors.nix b/modules/collectors.nix index 6f328ee..879516b 100644 --- a/modules/collectors.nix +++ b/modules/collectors.nix @@ -148,11 +148,16 @@ in devices = mkOption { type = types.listOf types.str; default = [ ]; - example = [ "/dev/sda" "/dev/nvme0" ]; + example = [ "/dev/sda" "/dev/nvme0" "/dev/bus/0;megaraid,1" ]; description = '' - Devices to poll. Empty means auto-discovery via `smartctl --scan`, which is - correct for direct-attached AHCI/HBA disks. Behind a RAID controller you - generally have to list devices explicitly with their `-d` type. + Devices to poll, shared by the smartctl exporter and the self-test collector. + Empty means auto-discovery via `smartctl --scan`, which is correct for + direct-attached AHCI/HBA disks. Behind a RAID controller `--scan` returns + nothing useful and you have to list the drives explicitly, giving each one its + `-d` type after a semicolon: `"/dev/bus/0;megaraid,1"`. + + Note that setting this also turns off the exporter's periodic rescan, so + hot-swapped drives will not be picked up until it restarts. ''; }; @@ -268,7 +273,15 @@ in systemd.services.smart-selftest-collector = mkIf cfg.smart.enable (mkCollectorService { description = "Collect SMART self-test history and drive identity"; - execStart = "${lib.getExe collectorPkgs.smart-selftest} --output ${cfg.textfileDir}/smart-selftest.prom"; + # The same device list the exporter gets. Without this the collector would fall + # back to its own `smartctl --scan`, which is exactly what cannot see the drives + # in the one configuration the option exists for -- so every row title would read + # "identity pending" and self-test history would be empty. + execStart = lib.escapeShellArgs ([ + (lib.getExe collectorPkgs.smart-selftest) + "--output" + "${cfg.textfileDir}/smart-selftest.prom" + ] ++ concatMap (device: [ "--device" device ]) cfg.smart.devices); # Same shape as the smartctl exporter's own hardening: raw device access to talk # to the disks, and nothing else. extraServiceConfig = { |
