utkuozdemir/nvidia_gpu_exporter
Acerca de
Exportador de GPU NVIDIA para Prometheus mediante el binario nvidia-smi o NVML.
IA y aprendizaje automáticoCrecimiento de estrellas medido
- in 24h
- +1
- in 7 days
- +7
- in 15 days
- +10
- in 1 month
- +26
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Originalnvidia_gpu_exporter
Prometheus exporter for NVIDIA GPUs, reading metrics directly from the NVIDIA driver library (NVML) or through nvidia-smi.
Can also attribute per-process GPU usage to containers, systemd services and MIG instances.
Runs on Linux, Windows and macOS, on bare metal, in Docker or on Kubernetes.
[!WARNING] Heads up: this is a side project I maintain in my spare time. I might take a long time to look at issues or PRs, or not get to them at all. Sorry in advance, and thanks for understanding.
Overview
The exporter collects utilization, memory, power, thermals, clocks, throttling reasons, ECC errors, encoder/decoder stats and per-process GPU usage, and exposes them as nvidia_smi_* Prometheus metrics.
It supports two hardware collection backends and a synthetic demo backend that share the same metric schema (metric names, base units, label sets and enum mappings) whenever they expose the same data (see CONFIGURE.md):
- Native NVML (
nvml, default on Linux and Windows): readslibnvidia-ml.so.1on Linux andnvml.dllon Windows in-process without spawningnvidia-smi. In addition to the shared metrics, it exports families only the driver library provides: XID and MIG XID error counters, total energy consumed, per-MIG-instance metrics, whole-GPU GPM activity ratios, PCIe throughput, replay and AER error counters, NVLink and C2C link metrics, per-fan speeds and RPM, BAR1 memory usage, thermal thresholds, and power source state. nvidia-smisubprocess (exec, default on macOS and Linux-static): runsnvidia-smiand parses its output (GPU CSV plus-q -d PIDSandpmon -c 1when per-process collection is enabled). Works as a static binary with zero C bindings on any platform wherenvidia-smiexists, isolates the exporter from stuck driver calls, auto-discovers brand-new driver fields, and supports custom wrapper commands (ssh,sudo). Pass--collect.backend=execon Linux or Windows to use it.- Synthetic demo (
demo): serves realistic synthetic metrics covering the NVML surface on any platform without a GPU or driver, enabled with--collect.backend=demo(see Demo mode).
Quick start
On a Linux machine with the NVIDIA driver and the NVIDIA Container Toolkit:
docker run -d --name nvidia_gpu_exporter --restart unless-stopped \
--gpus all -e NVIDIA_DRIVER_CAPABILITIES=utility -p 9835:9835 \
utkuozdemir/nvidia_gpu_exporter:latest
curl http://localhost:9835/metrics
Pass --collect.backend=exec after the image name if you prefer the nvidia-smi subprocess backend.
No GPU at hand? nvidia_gpu_exporter --collect.backend demo serves realistic synthetic metrics on any machine. For Windows, macOS, packages, Kubernetes and running without Docker, see INSTALL.md.
Workload attribution
The exporter can report GPU memory and (on non-MIG GPUs) engine utilization per process. It can also tie each process to its container (Docker, containerd, CRI-O, Podman) or systemd service (such as ollama.service) on Linux, and to its MIG instance on MIG GPUs.
On Kubernetes, those container IDs join with kube-state-metrics in PromQL to group per-process memory and utilization by namespace, pod and container, including when multiple pods time-slice a GPU.
In containers this uses host PID visibility (--pid=host / hostPID: true), and needs no container runtime socket or Kubernetes API permissions. It is opt-in: see Workload attribution in CONFIGURE.md to enable it and METRICS.md for the PromQL queries.
Use cases
- Consumer and prosumer GPUs (GeForce/RTX), workstations and gaming rigs, where datacenter fleet tooling exposes little or does not run
- Small Kubernetes clusters, edge boxes and homelabs that want GPU metrics, alerts and dashboards without installing the NVIDIA GPU Operator stack
- Virtualized or restricted setups (vGPU guests, MIG slices, locked-down containers, WSL2)
- Mixed fleets of old and new cards across Linux and Windows that need one exporter with a uniform metric schema
- Remote monitoring of another host over an
sshwrapper command (execbackend)
If you run a large datacenter fleet on Kubernetes with the GPU Operator already installed, DCGM-exporter is probably the better fit.
Demo mode
Demo mode serves realistic synthetic metrics covering the full NVML surface, with no GPU, driver or Linux required:
nvidia_gpu_exporter --collect.backend demo
By default it simulates two H200 GPUs with fluctuating values, a MIG topology and an XID error history. The simulated setup is configurable, see CONFIGURE.md.
Visualization
There are two official Grafana dashboards, and they link to each other in Grafana:
- Nvidia GPU Metrics (ID
14574), the per-GPU detail view. - Nvidia GPU Overview (ID
25547), which compares all GPUs of a node side by side and drills down into the detail dashboard.
Import either by ID in Grafana (Dashboards - New - Import), or enable grafanaDashboard in the Helm chart to get both provisioned automatically. The JSON files also live under docs/grafana.


Installation
INSTALL.md covers every platform:
- Linux:
deb/rpmpackages (glibc 2.34+), binary archives (default NVML and-static), and a systemd unit - Docker: container images on Docker Hub and GHCR
- Kubernetes: the Helm chart on Artifact Hub (including Prometheus alert rules and Grafana dashboards) or a plain DaemonSet
- Windows:
winget, Scoop, a native Windows service, or an all-in-one PowerShell script that also sets up Prometheus and Grafana - macOS: binary archive for remote scraping over SSH
Release artifacts, container images, and Helm charts are signed and carry GitHub build provenance attestations. See INSTALL.md for verification commands and SECURITY_MODEL.md for the security model.
Configuration and metrics
- CONFIGURE.md: flags, collection backends, per-process metrics and workload attribution, background collection, timeouts and
/-/gpu-healthy. - METRICS.md: metric families, labels, enum mappings, MIG and XID semantics, and Kubernetes /
vLLMPromQL joins.
Contributing
See CONTRIBUTING.md for the development setup, ROADMAP.md for what is planned, and GOVERNANCE.md for how decisions are made.
Contribute a GPU capture
The test suite replays recorded nvidia-smi output and NVML symbol lists from real hardware across GPU models, driver versions and operating systems. Recording a capture from a GPU or driver version not yet in the corpus takes one command:
./internal/captures/collect.sh # add --load for an under-load sample too
It runs read-only, masks identifiers (GPU UUID, serial, hostname) by default, and writes one .txt file. Commit it and open a PR, or attach it to an issue. See internal/captures/README.md.
Star History
Explorar proyectos relacionados
Cargando…