Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6cbdb50
docs: decide the metric model (#9) and device attachment (#10)
somethingwithproof Nov 15, 2026
83bbc43
feat: common metric model with generated documentation (#38)
somethingwithproof Nov 15, 2026
beac213
feat: read nvidia-smi through SNMP extend and parse it strictly (#35 …
somethingwithproof Nov 15, 2026
6a4a563
feat: collect each node after the poller and cache the samples (#37)
somethingwithproof Nov 15, 2026
1f034cc
feat: ship the GPU data query, templates, and script server input (#3…
somethingwithproof Nov 15, 2026
937c7ac
fix: sort the GPU data query by identity key alone (#39)
somethingwithproof Nov 15, 2026
aef0dc7
feat: attach the data query to node devices, reindex, and create GPU …
somethingwithproof Nov 15, 2026
cecdf06
fix: enforce device permissions on node and GPU actions (#40)
somethingwithproof Nov 15, 2026
e343ad4
fix: graph every model field so Cacti stores it (#43)
somethingwithproof Nov 15, 2026
1615601
test: end-to-end collection through a real snmpd (#35 #37 #40 #42 #43)
somethingwithproof Nov 15, 2026
b085b55
docs: milestone 3 status, and where the build differs from the plan (#3)
somethingwithproof Nov 15, 2026
e4ce77c
docs: update the plan status for milestone 3
somethingwithproof Nov 15, 2026
0f368ac
test: run the end-to-end check on its own node only (#73)
somethingwithproof Nov 15, 2026
baea2fe
fix: apply a GPU move or retirement only as it was authorized (#40)
somethingwithproof Nov 15, 2026
c54a7aa
fix: harden SNMP extend reads, passphrases, and locks (#35 #37)
somethingwithproof Nov 15, 2026
535a637
fix: keep reindex and collection state right when a write fails (#37 …
somethingwithproof Nov 15, 2026
7a5ca34
fix: repair a missing data query XML on the next upgrade check (#39)
somethingwithproof Nov 15, 2026
68c9fb5
fix: read the node through a Cacti SNMP session (#35)
somethingwithproof Nov 15, 2026
226b899
fix: compare Cacti's cached GPU fields, not only the indexes (#37)
somethingwithproof Nov 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,57 @@ jobs:
exit 1
fi

# End to end: a real net-snmp agent runs the extend lines from
# docs/node-setup.md against a fake nvidia-smi, the plugin reads it over
# SNMPv3, and Cacti's poller writes and graphs the RRD files.
- name: Start snmpd with the documented extend lines
working-directory: cacti/plugins/gpu
run: |
set -euo pipefail
sudo apt-get install -y snmpd
sudo systemctl stop snmpd || true
sudo install -m 755 tests/bin/fake-nvidia-smi /usr/bin/nvidia-smi
sudo install -d -o "$USER" -m 755 /var/lib/gpu-e2e
umask 077
# Random SNMPv3 passphrases, kept in a file.
{ openssl rand -hex 16; openssl rand -hex 16; } > "$RUNNER_TEMP/snmp-secrets"
php tests/bin/snmpd-conf.php "$RUNNER_TEMP/snmp-secrets" udp:127.0.0.1:1161 > "$RUNNER_TEMP/snmpd.conf"
sudo /usr/sbin/snmpd -Lf "$RUNNER_TEMP/snmpd.log" -C -c "$RUNNER_TEMP/snmpd.conf" -p "$RUNNER_TEMP/snmpd.pid"
sleep 1
if ! sudo kill -0 "$(sudo cat "$RUNNER_TEMP/snmpd.pid")"; then
sudo cat "$RUNNER_TEMP/snmpd.log" || true
exit 1
fi

# The test provokes collection failures, which the plugin logs as
# warnings. Its log is checked here for anything else, and the main log
# is put back for the check below.
- name: Run the end-to-end collection test
working-directory: cacti
env:
GPU_TEST_DATABASE: disposable
GPU_E2E_AGENT: 127.0.0.1:1161
GPU_E2E_FIXTURES: /var/lib/gpu-e2e
run: |
set -uo pipefail
mv log/cacti.log log/main.log
rc=0
GPU_E2E_SECRETS="$RUNNER_TEMP/snmp-secrets" php plugins/gpu/tests/bin/e2e.php || rc=$?
mv log/cacti.log log/e2e.log
mv log/main.log log/cacti.log
echo "== end-to-end log"
cat log/e2e.log
if grep -E "FATAL:|ERROR:|WARNING:" log/e2e.log | grep -v "GPU WARNING: Node [0-9]*: collection failed"; then
rc=1
fi
if [ "$rc" -ne 0 ]; then
echo "== snmpd log"
sudo cat "$RUNNER_TEMP/snmpd.log" || true
echo "== AppArmor messages"
sudo dmesg | grep -i apparmor || true
fi
exit "$rc"

- name: Check Cacti log for errors
if: always()
run: |
Expand Down
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A Cacti 1.2 plugin that brings per-GPU utilization, memory, temperature, power, ECC errors, XID errors, and throttling reasons from NVIDIA and AMD tools into Cacti. Each GPU becomes an index of a data query on its node's device, so GPU graphs sit next to the node's other graphs under Cacti's permissions, and Thold and Maint can alert on and suppress them.

> **Status: in development, no release yet.** Milestone 2 (foundation) is merged on `main`: the plugin installs, registers GPU nodes, and keeps GPU identity records, but it collects nothing. No vendor tool is run and no graph is created until milestone 3, which is not on `main`. Milestone 1 research is written up from documentation and source; checks that need GPU hardware are still open. Do not run the plugin in production. Everything below the milestone 2 section describes the plan, not shipped behavior.
> **Status: in development, no release yet.** Milestones 2 (foundation) and 3 (NVIDIA collection and Cacti objects) are merged on `main`. The plugin reads `nvidia-smi` on each GPU node through the node's SNMP agent, keeps GPU identity records, and creates one data query index, one data source, and eight graphs per GPU. It has been run only against a real `snmpd` with a fake `nvidia-smi` printing synthetic output, never on GPU hardware. Alerting, the health page, and the phase 1 release are milestone 4. Milestone 1 research is written up from documentation and source; checks that need GPU hardware are still open. Do not run it in production.

## Why

Expand All @@ -21,6 +21,18 @@ The plugin closes that gap by turning vendor tool output into Cacti data sources

Out of scope: any command that changes a GPU or node (clocks, power limits, resets, MIG layout), a plugin-owned alerting engine, a custom daemon or network protocol, and scheduler or job accounting. See the plan for the research backlog.

## What milestone 3 adds

- **Collection through SNMP extend** ([ADR 0008](docs/decisions/0008-collect-through-snmp-extend.md)). The node's administrator adds two fixed `extend` lines to `snmpd.conf` ([docs/node-setup.md](docs/node-setup.md)); the plugin reads NET-SNMP-EXTEND-MIB through Cacti's SNMP functions with the device's own credentials, SNMPv3 recommended. It runs nothing on the Cacti server or the node.
- **Strict parsing.** Fields are read by position, each line names its GPU by UUID, and a nonzero exit status, a timeout, truncated output, a line with the wrong field count, or merged error text fails the whole collection: values become `U`, no GPU is marked absent, and GPU Nodes shows why.
- **A collector after each poller cycle.** It reads each enabled node's agent, updates the identity records, and caches the latest sample. The script server input reads only that cache, so a Cacti poll never waits on a GPU node.
- **Cacti objects** ([ADR 0010](docs/decisions/0010-attach-to-existing-node-devices.md)). The templates and the *GPU - Devices* data query ship as XML and are imported on install and upgrade. Saving a node attaches the data query to its existing device with reindex method None; GPU Nodes can create a device only when the node has none. Each GPU is an index keyed by vendor and UUID, with one data source shared by its Utilization, Memory, Temperature, Power, Clocks, Throttle, ECC Errors, and Sample Age graphs. Every model field is drawn by some graph, because Cacti stores only the fields a graph uses. The plugin reindexes after every GPU change, keeps a reindex Cacti skipped while the device was Down or disabled and runs it once the device is Up, and creates graphs for new GPUs.
- **History stays with the card.** An absent GPU stays an index, so its graphs show a gap and resume in the same RRD file when it returns. A replacement card in the same slot gets its own data source. **Remove from Data Query** on the node's page takes an absent GPU out of the listing; its RRD files and graphs are kept until you delete them.
- **Device permissions on GPU Nodes.** A GPU Admin sees, changes, exports, and moves only nodes and GPUs on devices they may see in Cacti; a GPU move needs both nodes. A node whose device was deleted can only be disabled.
- **The common metric model** ([ADR 0009](docs/decisions/0009-common-metric-core-with-vendor-extensions.md), [docs/metrics.md](docs/metrics.md)). Memory is in bytes, the clock event mask is decoded into `thr_*` indicators, and `age` is the age of the GPU's own sample time, or `U` when unknown.

The installing (web server) user must be able to write `<cacti>/resource/script_server/`, where the plugin places its data query XML; install and upgrade stop with a message otherwise and retry on the next attempt. Uninstall does not yet remove the templates or the XML (#30). Nodes on remote data collectors are not collected until phase 3.

## What milestone 2 ships

- **A guarded install.** On PHP below 8.2, install and enable are refused with a message naming the required version, and the rest of Cacti keeps working. `setup.php` and the page scripts parse on PHP 8.0.
Expand All @@ -31,16 +43,17 @@ Out of scope: any command that changes a GPU or node (clocks, power limits, rese

### Install for evaluation

These steps install the milestone 2 code to try it. They require Cacti 1.2.31 or later on PHP 8.2 or later.
These steps install the milestone 3 code to try it. They require Cacti 1.2.31 or later on PHP 8.2 or later.

1. Copy the repository to `plugins/gpu` under your Cacti directory. The directory must be named `gpu`.
2. In Cacti, open **Configuration > Plugins**, then install and enable **GPU**.
3. Give users the *GPU View* or *GPU Admin* realm under **Configuration > Users**. The installing user gets both.
4. Optionally adjust **Configuration > Settings > GPU**: *Mark Absent After* (default 3 successful collections, from 1 to 100) and *Keep Plugin Tables on Uninstall* (default on).
4. Set up each GPU node's SNMP agent as described in [docs/node-setup.md](docs/node-setup.md), then add the node under **Management > GPU Nodes**.
5. Optionally adjust **Configuration > Settings > GPU**: *Mark Absent After* (default 3 successful collections, from 1 to 100), *Stale After* (how old a sample may be before its values print `U`), and *Keep Plugin Tables on Uninstall* (default on).

## Collection path
## How metrics reach Cacti

Decision [#7](https://github.com/somethingwithproof/plugin_gpu/issues/7) chose SNMP `extend` on the GPU node: the node's administrator configures `snmpd` to run the vendor tool with a fixed argument list, and the plugin reads the output through Cacti's SNMP polling of that device. The reasons and rejected alternatives are in [ADR 0008](docs/decisions/0008-collect-through-snmp-extend.md). The collector is not implemented yet. A poller on the node and a `dcgm-exporter` scrape remain possible later backends; see [Collection paths](docs/PLAN.md#collection-paths).
Decision [#7](https://github.com/somethingwithproof/plugin_gpu/issues/7) chose SNMP `extend` ([ADR 0008](docs/decisions/0008-collect-through-snmp-extend.md)): the node's own agent runs a fixed `nvidia-smi` command and the plugin only reads the result. The plan compares the options under [Collection paths](docs/PLAN.md#collection-paths).

## Compatibility targets

Expand All @@ -60,7 +73,7 @@ Decision [#7](https://github.com/somethingwithproof/plugin_gpu/issues/7) chose S

```mermaid
flowchart LR
NODE[GPU node: nvidia-smi, DCGM, amd-smi] -->|SNMP extend| C[Collector]
NODE[GPU node: snmpd extend running nvidia-smi] -->|SNMP reads, v3 recommended| C[Collector]
C --> CACHE[(Plugin cache keyed by GPU UUID)]
CACHE --> SS[Script server data query input]
SS --> RRD[(Cacti RRD files, one data source per GPU)]
Expand Down
7 changes: 5 additions & 2 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ version = 1

# Files that cannot carry a comment header, or whose format makes one
# awkward: documentation, repository metadata, GitHub templates, test
# configuration and fixtures, and translation catalogs, which gettext
# regenerates.
# configuration and fixtures, translation catalogs, which gettext
# regenerates, and the Cacti template and data query XML, which
# lib/TemplateXml.php generates and Cacti imports as is.
[[annotations]]
path = [
"README.md",
Expand All @@ -19,6 +20,8 @@ path = [
"tests/fixtures/**",
"locales/po/**",
"locales/LC_MESSAGES/**",
"templates/*.xml",
"resource/script_server/*.xml",
]
precedence = "aggregate"
SPDX-FileCopyrightText = "2026 Thomas Vincent <thomasvincent@gmail.com>"
Expand Down
Loading
Loading