Skip to content

Commit

Permalink
nixos/prometheus-smartctl-exporter: providing the path to the binary …
Browse files Browse the repository at this point in the history
…is no longer needed
  • Loading branch information
peterhoeg committed Jul 31, 2024
1 parent 0bab1a6 commit c3392ad
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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" ];
'';
Expand All @@ -24,6 +27,7 @@ in {
all disks if none given.
'';
};

maxInterval = mkOption {
type = types.str;
default = "60s";
Expand All @@ -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";
Expand Down

0 comments on commit c3392ad

Please sign in to comment.