nixos/prometheus.exporters.smartctl: use cli args instead of config
Config support was dropped and replaced with CLI args
This commit is contained in:
parent
4848003a66
commit
a49feed255
|
@ -4,16 +4,12 @@ with lib;
|
|||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.smartctl;
|
||||
format = pkgs.formats.yaml {};
|
||||
configFile = format.generate "smartctl-exporter.yml" {
|
||||
smartctl_exporter = {
|
||||
bind_to = "${cfg.listenAddress}:${toString cfg.port}";
|
||||
url_path = "/metrics";
|
||||
smartctl_location = "${pkgs.smartmontools}/bin/smartctl";
|
||||
collect_not_more_than_period = cfg.maxInterval;
|
||||
devices = cfg.devices;
|
||||
};
|
||||
};
|
||||
args = concatStrings [
|
||||
"--web.listen-address=\"${cfg.listenAddress}:${toString cfg.port}\" "
|
||||
"--smartctl.path=\"${pkgs.smartmontools}/bin/smartctl\" "
|
||||
"--smartctl.interval=\"${cfg.maxInterval}\" "
|
||||
"${concatMapStringsSep " " (device: "--smartctl.device=${device}") cfg.devices}"
|
||||
];
|
||||
in {
|
||||
port = 9633;
|
||||
|
||||
|
@ -60,7 +56,7 @@ in {
|
|||
]
|
||||
);
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter -config ${configFile}
|
||||
${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter ${args}
|
||||
'';
|
||||
PrivateDevices = lib.mkForce false;
|
||||
ProtectProc = "invisible";
|
||||
|
|
Loading…
Reference in a new issue