1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

nixos/prometheus-smartctl-exporter: providing the path to the binary is no longer needed

This commit is contained in:
Peter Hoeg 2024-07-29 20:53:40 +02:00
parent 0bab1a6d6e
commit c3392ad349

View file

@ -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";