For details on GitHub Actions status badges, see the official documentation.
rdma_exporter collects RDMA (InfiniBand/RoCE) NIC statistics from Linux hosts and exposes them as Prometheus metrics. The exporter walks the kernel's sysfs tree directly and publishes metrics with github.com/prometheus/client_golang.
- Publishes counters from
/sys/class/infiniband/<dev>/<port>/countersand/hw_countersasrdma_<counter>_totalmetrics that match NVIDIA's Understanding mlx5 Linux Counters and Status Parameters guide (e.g.rdma_port_rcv_data_total,rdma_symbol_error_total,rdma_duplicate_request_total). - Exposes port metadata (link layer, state, width, speed, PCI address, VF/PF relationship, etc.) through
rdma_port_info. - Tracks scrape failures with
rdma_scrape_errors_total. - Supports device exclusion (
--exclude-devices) to prevent kernel log flooding on firmware-restricted devices (NVIDIA DGX, Umbriel, GB200 systems). - Ships with an HTTP server that serves
/metricsand/healthzand gracefully shuts down onSIGINT/SIGTERM. - Supports an alternative sysfs root (
--sysfs-root) for testing or chroot environments. - Honors a configurable scrape timeout (
--scrape-timeout) to protect long-running sysfs reads. - Optionally enriches RoCEv2 visibility with PFC counters from netdev ethtool stats (Linux only, best effort).
- Go 1.25 or newer.
- Linux with read access to
/sys/class/infiniband(for production use).
go build -o rdma_exporter .Alternatively, use the provided Makefile helpers:
make build # compiles ./rdma_exporter
make test # runs go test ./...
make lint # runs go vet ./..../rdma_exporter \
--listen-address=":9879" \
--metrics-path="/metrics" \
--health-path="/healthz"To exclude specific devices that trigger firmware errors (e.g., on NVIDIA DGX/GB200 systems):
./rdma_exporter --exclude-devices=mlx5_0,mlx5_1To print build information without starting the server, add --version.
Every CLI flag has an equivalent environment variable. Environment values provide defaults; explicit CLI flags take precedence.
| Flag | Environment | Default | Description |
|---|---|---|---|
--listen-address |
RDMA_EXPORTER_LISTEN_ADDRESS |
:9879 |
HTTP listen address |
--metrics-path |
RDMA_EXPORTER_METRICS_PATH |
/metrics |
Metrics endpoint path |
--health-path |
RDMA_EXPORTER_HEALTH_PATH |
/healthz |
Health check endpoint path |
--log-level |
RDMA_EXPORTER_LOG_LEVEL |
info |
Log verbosity (debug, info, warn, error) |
--sysfs-root |
RDMA_EXPORTER_SYSFS_ROOT |
/sys |
Root directory used to read RDMA sysfs data |
--scrape-timeout |
RDMA_EXPORTER_SCRAPE_TIMEOUT |
5s |
Upper bound for metric gathering per scrape |
--enable-roce-pfc-metrics |
RDMA_EXPORTER_ENABLE_ROCE_PFC_METRICS |
true |
Enable RoCEv2 PFC metric collection from netdev ethtool stats (Linux only) |
--exclude-devices |
RDMA_EXPORTER_EXCLUDE_DEVICES |
`` | Comma-separated list of RDMA devices to exclude (e.g., mlx5_0,mlx5_1) |
rdma_<counter>_total{device,port}– Port and hardware counters aligned with NVIDIA documentation (e.g.rdma_port_rcv_data_total,rdma_symbol_error_total,rdma_duplicate_request_total).rdma_port_info{device,port,link_layer,state,phys_state,link_width,link_speed,pci_addr,is_vf,pf_device}– Gauge set to1with descriptive labels.pci_addrcarries the device's PCI address (e.g.0000:1a:00.0);is_vfis"true"for SR-IOV virtual functions;pf_devicenames the parent PF IB device whenis_vf="true"(empty otherwise). These enable joins with external sources keyed by PCI address (e.g.sriov_kubepoddevice) for per-VF/per-pod RDMA bandwidth attribution.rdma_scrape_errors_total{}– Counter incremented when sysfs collection fails.rdma_roce_pfc_pause_frames_total{device,port,netdev,direction,priority}– RoCEv2 PFC pause frame counters from ethtool stats.rdma_roce_pfc_pause_duration_total{device,port,netdev,direction,priority}– RoCEv2 PFC pause duration counters from ethtool stats.rdma_roce_pfc_pause_transitions_total{device,port,netdev,direction,priority}– RoCEv2 PFC pause transition counters from ethtool stats.rdma_roce_pfc_scrape_errors_total{}– Counter incremented when PFC metric collection fails.
The Go and process collectors from client_golang are registered automatically.
- Grafana dashboard: RDMA/RoCE NIC Telemetry – Prebuilt panels for visualizing the exporter metrics, helpful for quick validation and long-term monitoring.
go test ./...For deterministic builds in shared environments, you can pin Go's caches locally:
GOCACHE=$(pwd)/.gocache GOMODCACHE=$(pwd)/.gomodcache go test ./...internal/rdma/testdata/sysfs contains fixture trees used in unit tests to emulate sysfs layouts.
- A systemd unit file is available under
deploy/systemd/rdma_exporter.service. - A multi-stage Dockerfile lives at the repository root; see
docs/deployment.mdfor build and run instructions.
- Architectural decisions and future work are documented in
docs/design.md. - Logging uses the Go standard library
log/slog. Set--log-level=debugfor detailed scrape traces. - Deployment guidance (systemd and container) lives in
docs/deployment.md.
This project is licensed under the MIT License. See LICENSE for full text.
