diff --git a/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix b/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix index 8aadd87abbed..e3dcc6126ff1 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix @@ -2,20 +2,23 @@ let cfg = config.services.prometheus.exporters.smartctl; + inherit (lib) mkOption types literalExpression; + args = lib.escapeShellArgs ([ "--web.listen-address=${cfg.listenAddress}:${toString cfg.port}" - "--smartctl.path=${pkgs.smartmontools}/bin/smartctl" "--smartctl.interval=${cfg.maxInterval}" ] ++ map (device: "--smartctl.device=${device}") cfg.devices ++ cfg.extraFlags); -in { + +in +{ port = 9633; extraOpts = { devices = mkOption { type = types.listOf types.str; - default = []; + default = [ ]; example = literalExpression '' [ "/dev/sda", "/dev/nvme0n1" ]; ''; @@ -24,6 +27,7 @@ in { all disks if none given. ''; }; + maxInterval = mkOption { type = types.str; default = "60s"; @@ -50,9 +54,7 @@ in { "block-sd rw" "char-nvme rw" ]; - ExecStart = '' - ${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter ${args} - ''; + ExecStart = "${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter ${args}"; PrivateDevices = lib.mkForce false; ProtectProc = "invisible"; ProcSubset = "pid";