This is a Rust implementation of an NVML exporter for Prometheus.
- NVIDIA GPU drivers providing
- Windows:
nvml.dll
in$env:PATH
(this should be the case by default using normal GeForce drivers) - Linux:
libnvidia-ml.so
in$LD_LIBRARY_PATH
- Windows:
- [Build only]: Rust >1.53 installed
Non-Windows-service binary:
cargo build --bin nvml_exporter
Windows service binary:
cargo build --bin nvml_exporter_svc --features=winsvc
On Linux w/o dedicated packaging, copy the binary to /usr/local/bin
and add a systemd
unit file?:
[Unit]
Description=NVML Exporter
Wants=multi-user.target
[Service]
Type=simple
ExecStart=/usr/local/bin/nvml_exporter
On Windows, you can use the nvml-exporter
chocolatey package to install this. In order to preserve package --param
flags from installation, first run:
choco feature enable --name=useRememberedArgumentsForUpgrades
Then install the package using:
choco install nvml-exporter
You can change the port used for listening (default=9996):
--params "'/ListenPort:12345'"
You can also enable collection of GPU throttling reasons (disabled by default):
--params "'/EnableThrottleReasons'"
ECC memory error collection is disabled unless ECC memory is available and currently in ECC mode. GeForce series GPUs do not have ECC memory.
If you need a custom package build for testing, see the "Packaging" section below.
Listen on wildcard v4/v6 (default):
./target/debug/nvml-exporter-rs.exe
Listen on a specific bind address:
./target/debug/nvml-exporter-rs.exe --listen 127.0.0.1:9500
See the NVML Device Queries documentation potentially available metrics.
Currently implemented metrics are the fields of the Metrics
struct in main.rs
.
New metrics may be added by:
- Adding the field to the
Metrics
struct.Gauge
should be used for global (system-wide) metrics, whereasGaugeVec
should be used for metrics that are per-device. - Adding the field initialization to
Metrics::new()
with the appropriate macro. - Adding the collection implementation to
main::gather()
. - New metrics should have their collection time impact measured with the
timed!
macro provided inline, and if costlier than a few milliseconds they should have an enable/disable mechanism flag added to the binary (see for example--throttle-reasons
)
Build the Chocolatey package with:
.\scripts\mkchoco.bat
Install the Chocolatey package you just built with:
.\scripts\install.bat
Binary releases are currently created for Windows platforms only.
- Push a commit bumping the version number in
packaging\choco\nvml-exporter\nvml-exporter.nuspec
and inCargo.toml
- Create a new release on GitHub
- Wait for the
release
GitHub Action to complete successfully - Open the
release
action summary and download the artifact zip file - Extract the
.nupkg
from the artifact zip and attach it to the release - Check https://community.chocolatey.org/account/Packages for the pending Chocolatey release
- Make sure the new version passes moderation
- GitHub Action for the
release
event builds anupkg
- GitHub Action for the
release
event publishes thenupkg
build to Chocolatey.org - The new version is held for moderation on Chocolatey.org
- Any moderation issues on Chocolatey.org are resolved
- Package is released for public visibility by Chocolatey.org package moderators