nixos/prometheus-nut-exporter: use extraFlags, add nutVariables option
This commit is contained in:
parent
5863c27340
commit
bbad81f937
@ -36,6 +36,17 @@ in
|
||||
provisioned outside of Nix store.
|
||||
'';
|
||||
};
|
||||
nutVariables = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of NUT variable names to monitor.
|
||||
|
||||
If no variables are set, all numeric variables will be exported automatically.
|
||||
See the [upstream docs](https://github.com/DRuggeri/nut_exporter?tab=readme-ov-file#variables-and-information)
|
||||
for more information.
|
||||
'';
|
||||
};
|
||||
};
|
||||
serviceOpts = {
|
||||
script = ''
|
||||
@ -44,7 +55,9 @@ in
|
||||
${pkgs.prometheus-nut-exporter}/bin/nut_exporter \
|
||||
--nut.server=${cfg.nutServer} \
|
||||
--web.listen-address="${cfg.listenAddress}:${toString cfg.port}" \
|
||||
${optionalString (cfg.nutUser != "") "--nut.username=${cfg.nutUser}"}
|
||||
${optionalString (cfg.nutUser != "") "--nut.username=${cfg.nutUser}"} \
|
||||
${optionalString (cfg.nutVariables != []) "--nut.vars_enable=${concatStringsSep "," cfg.nutVariables}"} \
|
||||
${concatStringsSep " " cfg.extraFlags}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user