Deployment

Everything in deploy/ runs the one server that xpustat --ui and xpustat --serve-prometheus start: a page at /, device JSON at /json, Prometheus text at /metrics, the cluster payload at /cluster. Pick the piece that fits the machine.

Container

docker build -t xpustat -f deploy/Dockerfile .
docker run --rm -p 9400:9400 --gpus all xpustat                        # NVIDIA, with the NVIDIA container toolkit
docker run --rm -p 9400:9400 --gpus all xpustat --serve-prometheus 9400 --cpu   # exporter only

The image holds xpustat and psutil; the vendor tools come from the host driver. The NVIDIA runtime injects nvidia-smi. For AMD, base the image on a ROCm image so amd-smi is present and pass --device=/dev/kfd --device=/dev/dri. The default command is --ui --host 0.0.0.0 --cpu -i 5, bound to all interfaces because the page is reached through the port mapping.

systemd

sudo cp deploy/xpustat.service /etc/systemd/system/
sudo systemctl daemon-reload && sudo systemctl enable --now xpustat

The unit runs xpustat --ui --host 0.0.0.0 --port 9400 --cpu -i 5 --history 1h as a dynamic user with a read-only system. Change ExecStart for the exporter alone or for a cluster page with --hosts-file /etc/xpustat/hosts. Per-process names inside containers need the docker group or root.

Kubernetes

deploy/k8s-daemonset.yaml runs one exporter per node, annotated for Prometheus discovery, with hostPID so process names and pod attribution work, and a liveness probe that runs xpustat --check. The NVIDIA device plugin exposes nvidia-smi through the runtime with NVIDIA_VISIBLE_DEVICES=all and NVIDIA_DRIVER_CAPABILITIES=utility; no GPU is reserved.

Grafana

Import deploy/grafana-dashboard.json. It has panels for memory, utilization, temperature, power, energy per hour, throttling and health, hosts up, and processes, with host and vendor variables. The host variable needs the host label, which the cluster exporter (xpustat --ui --ssh ..., see Web UI) adds; for per-node exporters, add it with Prometheus relabeling.

Alerts

xpustat --ui --alert-url https://hooks.example/... POSTs new alerts as JSON ({"source", "time", "alerts": [...], "text"}) and re-sends a still-active one after --alert-cooldown seconds (default 1800). For a cron job or a probe, xpustat --check prints the alerts and exits 1 when there is any; --max-temp, --min-free and --no-alert-throttle set the thresholds, and --hosts or --ssh check other machines.

Health check from a script

xpustat --check --max-temp 80 --min-free 2000 && echo "all clear"
xpustat --check --ssh node1 node2 --json | jq '.[] | select(.level == "critical")'

Documentation site

mkdocs gh-deploy is run by CI on every push to main, so the docs are at the repository's GitHub Pages address.