mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-11 10:16:01 +01:00
This exporter allows prometheus-nvidia-gpu-exporter to be installed as a systemd service.
30 lines
609 B
Nix
30 lines
609 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.nvidia-gpu;
|
|
inherit (lib)
|
|
types
|
|
concatStringsSep
|
|
;
|
|
in
|
|
{
|
|
port = 9835;
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
ExecStart = ''
|
|
${pkgs.prometheus-nvidia-gpu-exporter}/bin/nvidia_gpu_exporter \
|
|
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
|
--nvidia-smi-command ${config.hardware.nvidia.package.bin}/bin/nvidia-smi \
|
|
${concatStringsSep " " cfg.extraFlags}
|
|
'';
|
|
PrivateDevices = false;
|
|
};
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
}
|