mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
nixos/prometheus-smartctl-exporter: providing the path to the binary is no longer needed
This commit is contained in:
parent
0bab1a6d6e
commit
c3392ad349
@ -2,20 +2,23 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.prometheus.exporters.smartctl;
|
cfg = config.services.prometheus.exporters.smartctl;
|
||||||
|
|
||||||
inherit (lib) mkOption types literalExpression;
|
inherit (lib) mkOption types literalExpression;
|
||||||
|
|
||||||
args = lib.escapeShellArgs ([
|
args = lib.escapeShellArgs ([
|
||||||
"--web.listen-address=${cfg.listenAddress}:${toString cfg.port}"
|
"--web.listen-address=${cfg.listenAddress}:${toString cfg.port}"
|
||||||
"--smartctl.path=${pkgs.smartmontools}/bin/smartctl"
|
|
||||||
"--smartctl.interval=${cfg.maxInterval}"
|
"--smartctl.interval=${cfg.maxInterval}"
|
||||||
] ++ map (device: "--smartctl.device=${device}") cfg.devices
|
] ++ map (device: "--smartctl.device=${device}") cfg.devices
|
||||||
++ cfg.extraFlags);
|
++ cfg.extraFlags);
|
||||||
in {
|
|
||||||
|
in
|
||||||
|
{
|
||||||
port = 9633;
|
port = 9633;
|
||||||
|
|
||||||
extraOpts = {
|
extraOpts = {
|
||||||
devices = mkOption {
|
devices = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [ ];
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
[ "/dev/sda", "/dev/nvme0n1" ];
|
[ "/dev/sda", "/dev/nvme0n1" ];
|
||||||
'';
|
'';
|
||||||
@ -24,6 +27,7 @@ in {
|
|||||||
all disks if none given.
|
all disks if none given.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
maxInterval = mkOption {
|
maxInterval = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "60s";
|
default = "60s";
|
||||||
@ -50,9 +54,7 @@ in {
|
|||||||
"block-sd rw"
|
"block-sd rw"
|
||||||
"char-nvme rw"
|
"char-nvme rw"
|
||||||
];
|
];
|
||||||
ExecStart = ''
|
ExecStart = "${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter ${args}";
|
||||||
${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter ${args}
|
|
||||||
'';
|
|
||||||
PrivateDevices = lib.mkForce false;
|
PrivateDevices = lib.mkForce false;
|
||||||
ProtectProc = "invisible";
|
ProtectProc = "invisible";
|
||||||
ProcSubset = "pid";
|
ProcSubset = "pid";
|
||||||
|
Loading…
Reference in New Issue
Block a user