Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f56b584
fix(nodes): settle removal of orphan nodes and invisible created devices
somethingwithproof Nov 15, 2026
ecef1c7
feat(metrics): add ECC deltas, retired pages, and ECC mode (#45)
somethingwithproof Nov 15, 2026
07c6bdb
feat(alerting): ship Thold templates and an end-to-end alert test (#4…
somethingwithproof Nov 15, 2026
1e78245
feat(health): add the GPU Health page and widen the permission suite …
somethingwithproof Nov 15, 2026
20babde
test(failure): qualify phase 1 collection failures end to end (#52)
somethingwithproof Nov 15, 2026
6239e74
fix(provisioner): never let a new GPU data source inherit an RRD file…
somethingwithproof Nov 15, 2026
cf81f6f
test(scale): measure collection and Cacti objects at a given GPU coun…
somethingwithproof Nov 15, 2026
45c7d8d
ci: run the alert, failure, restore, and scale tests with Thold and M…
somethingwithproof Nov 15, 2026
bc9bea1
docs: add operator, alerting, backup, pilot, and security review docs…
somethingwithproof Nov 15, 2026
99e91ef
chore(release): prepare 0.1.0 packaging and the changelog (#51)
somethingwithproof Nov 15, 2026
feb0c80
fix(snmp): report an agent that gives no output lines as unreachable
somethingwithproof Nov 15, 2026
0bb1fd0
test(e2e): keep the end-to-end flows from leaking state into each other
somethingwithproof Nov 15, 2026
bfa14cd
feat(lifecycle): remove the plugin's Cacti objects on uninstall when …
somethingwithproof Nov 15, 2026
8c0476e
feat(nvidia): read clocks_event_reasons with a clocks_throttle_reason…
somethingwithproof Nov 15, 2026
2be3042
test(e2e): wait for Thold and other runs before reading what they cha…
somethingwithproof Nov 16, 2026
a7989c5
docs(nodes): show the two required extend lines first and cap GPUs pe…
somethingwithproof Nov 16, 2026
d1ec62a
fix: preserve GPU history across collection gaps and restores
somethingwithproof Nov 16, 2026
b24b517
fix: retain GPU recovery state until poller cache is ready
somethingwithproof Nov 16, 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
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
* text=auto eol=lf
*.rrd binary

# Left out of release archives (git archive): CI, tests and their
# synthetic fixtures, and developer tooling (REQ-REL-003).
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/tests export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/phpunit-integration.xml export-ignore
88 changes: 82 additions & 6 deletions .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
integration-test:
name: PHP ${{ matrix.php }} on Cacti ${{ matrix.cacti }}
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 75

strategy:
fail-fast: false
Expand Down Expand Up @@ -179,9 +179,9 @@ jobs:
GPU_TEST_DATABASE: disposable
run: '"$CACTI_PEST_BIN" --configuration=phpunit-integration.xml'

# The integration tests provoke refusals that the plugin logs as errors,
# such as a schema downgrade. Keep their log apart so the error check
# below covers the install and the poller run.
# The integration tests provoke refusals that the plugin logs, such as
# a schema downgrade. Keep their log apart; the check below allows only
# those refusals in it and nothing at all in the install and poller run.
- name: Set the integration tests' log aside
if: always()
run: |
Expand Down Expand Up @@ -279,20 +279,96 @@ jobs:
fi
exit "$rc"

# Thold and Maint at the tagged releases the plugin is tested against,
# unchanged. The plugin never loads them; the alert test drives them as an
# operator would (docs/alerting.md).
- name: Checkout Thold v1.8.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Cacti/plugin_thold
ref: 1eb406bd0f81f3204358cce7bd43c8bb5adc8e4a
path: cacti/plugins/thold
persist-credentials: false

- name: Checkout Maint v1.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Cacti/plugin_maint
ref: cd62de9cc323a4f5a8ac80a8d9dda3c7fa16c470
path: cacti/plugins/maint
persist-credentials: false

# Each test runs in the same database as the end-to-end test, after it.
# The failure and restore tests provoke collection, database, and RRD
# errors on purpose, so their logs are printed but not checked; each
# test checks the state those errors leave. The alert and scale logs must
# hold nothing but expected collection failures, and no TypeError.
- name: Run the alerting, failure, restore, and scale tests
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
export GPU_E2E_SECRETS="$RUNNER_TEMP/snmp-secrets"
mv log/cacti.log log/main.log
rc=0
php cli/plugin_manage.php --plugin=thold --plugin=maint --install --enable || rc=1
php plugins/gpu/tests/bin/alert-flow.php || rc=$?
mv log/cacti.log log/alert.log
echo "== alert log"
cat log/alert.log
# The test polls off the cron schedule, so Cacti may warn that the
# poll is out of sync and that it cannot mail the admin about it.
if grep -E "FATAL:|ERROR:|WARNING:|TypeError" log/alert.log | grep -v -e "GPU WARNING: Node [0-9]*: collection failed" -e "Cactid/Cron is out of sync" -e "Primary Admin account notifications disabled"; then
rc=1
fi
for flow in failure restore; do
php "plugins/gpu/tests/bin/$flow-flow.php" || rc=$?
echo "== $flow log, not checked"
if [ -f log/cacti.log ]; then
mv log/cacti.log "log/$flow.log"
cat "log/$flow.log"
fi
done
php -d memory_limit=2G plugins/gpu/tests/bin/scale-flow.php 100 provision || rc=$?
if [ -f log/cacti.log ]; then
mv log/cacti.log log/scale.log
echo "== scale log"
cat log/scale.log
# The test polls off the cron schedule, so Cacti may warn that the
# poll is out of sync and that it cannot mail the admin about it,
# and the devices the failure and permission tests left down fail
# their polls with no notification receiver configured.
if grep -E "FATAL:|ERROR:|WARNING:" log/scale.log | grep -v -e "Cactid/Cron is out of sync" -e "Primary Admin account notifications disabled" -e "No notification receivers configured for event: cactiNotifyDeviceFailedPoll"; then
rc=1
fi
fi
mv log/main.log log/cacti.log
exit "$rc"

- name: Check Cacti log for errors
if: always()
run: |
rc=0
if [ -f cacti/log/integration.log ]; then
echo "== integration tests (not checked)"
echo "== integration tests"
cat cacti/log/integration.log
# Two refusals are provoked on purpose: a schema newer than the
# code, and a second record for a stored GPU UUID.
if grep -E "FATAL:|ERROR:|WARNING:" cacti/log/integration.log | grep -v -e "GPU ERROR: Schema version 99 is newer than this code" -e "GPU WARNING: Node [0-9]*: a new GPU record was not stored because GPU record [0-9]* already has its UUID"; then
rc=1
fi
fi
if [ -f cacti/log/cacti.log ]; then
echo "== install and poller run"
cat cacti/log/cacti.log
if grep -E "FATAL:|ERROR:|WARNING:" cacti/log/cacti.log; then
exit 1
rc=1
fi
fi
exit "$rc"

# A 1.2.31 site may still run PHP 8.1. Enabling the plugin there must be
# refused with a message and leave Cacti working, both on a fresh install
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

All user-visible changes are listed here. Versions follow [Semantic Versioning](https://semver.org/); there is no release yet.

## Unreleased

Phase 1 (NVIDIA through SNMP extend), first version 0.1.0. Not yet run on GPU hardware; see [docs/pilot-plan.md](docs/pilot-plan.md).

### Added

- Install, upgrade, disable, and uninstall through Cacti's Plugins page, refused with a message on PHP below 8.2.
- GPU Nodes (GPU Admin), GPU Inventory and GPU Health (GPU View), each limited to devices the user may see.
- GPU identity records keyed by vendor and UUID, with replacement detection, confirmed moves between nodes, absence after a configurable number of collections, and JSON export.
- Collection of `nvidia-smi` through two fixed SNMP `extend` lines on each node ([docs/node-setup.md](docs/node-setup.md)), with strict parsing that turns any bad output into unknown values.
- The *GPU - Devices* data query, the *GPU - Metrics* data template, and ten graphs per GPU: Utilization, Memory, Temperature, Power, Clocks, Throttle, ECC Errors, New ECC Errors, Retired Pages, and Sample Age.
- Decoded clock event reasons as alertable 0 or 1 indicators, with the raw mask kept and shown on GPU Health.
- The clock event reasons are read as `clocks_event_reasons.active`, falling back to `clocks_throttle_reasons.active` through an optional third extend entry, `cacti_gpu_legacy`, when nvidia-smi refuses the new name (#36).
- At most 128 GPUs per node are supported, which keeps the metrics output well under snmpd's 100 KiB limit.
- New corrected and uncorrected ECC errors since the previous sample, computed by the plugin as gauges; retired single-bit and double-bit page counts; the ECC mode, shown on GPU Health when ECC values are unknown.
- Thold threshold templates for temperature, power against its limit, the hardware and thermal throttle indicators, new uncorrected ECC errors, pending page retirement, and sample age ([docs/alerting.md](docs/alerting.md)).
- The GPU Health page: freshness, last collection outcome, Maint state, backend, tool and driver versions, GPU presence, ECC state, and the raw clock event mask. It never contacts a node.
- An RRD file found at a new GPU data source's path is renamed instead of reused, so a database restored older than the RRD directory attaches no history to another GPU ([docs/backup.md](docs/backup.md)).
- *Remove the plugin's Cacti objects on uninstall* (default off): uninstall then removes the plugin's templates that nothing outside it uses, and its data query XML if unchanged. It never deletes RRD files, devices, graphs, or data sources.
- Operator, alerting, backup, performance, and security review documentation.

### Upgrade notes

- Schema version 3 adds the observation columns `ecc_corr_new`, `ecc_uncorr_new`, `retired_sbe`, `retired_dbe`, and `ecc_mode`. The upgrade runs when the Plugins page or a GPU page is opened.
- The metrics `extend` line now also asks for `ecc.mode.current`, `retired_pages.sbe`, and `retired_pages.dbe`. Update it on every node from [docs/node-setup.md](docs/node-setup.md); until then the node's collection fails with *Output rejected*.
- Only on a node whose `nvidia-smi` is older than the clock event reasons rename, add the optional `cacti_gpu_legacy` extend line from the same page. A metrics line with the current field list that asks for `clocks_throttle_reasons.active` in the last position also works, because both names print the same bitmask there; a line with the earlier field list does not.
- Re-import `templates/gpu_thold_templates.xml` in Thold to pick up template changes.

### Not yet supported

- XID errors: no source fits the fixed `nvidia-smi` commands; decision #8.
- DCGM and AMD backends (phase 2), MIG instances and remote data collectors (phase 3).
2 changes: 1 addition & 1 deletion INFO
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

[info]
name = gpu
version = 0.1.0-dev
version = 0.1.0
longname = GPU
author = "Thomas Vincent (somethingwithproof)"
email = thomasvincent@gmail.com
Expand Down
22 changes: 17 additions & 5 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.** 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.
> **Status: in development, not released.** Milestone 4 makes phase 1 (NVIDIA through SNMP extend) code complete: collection, identity, graphs, throttle and ECC signals, Thold and Maint alerting, the health page, and the operator documentation. It has been run only against a real `snmpd` with a fake `nvidia-smi` printing synthetic output, never on GPU hardware. Still open before a release: pilots on real hardware ([docs/pilot-plan.md](docs/pilot-plan.md), #54), an external security review ([docs/security-review.md](docs/security-review.md)), fixtures captured from real tools (#14), and scale measured on production-sized hardware ([docs/performance.md](docs/performance.md)). XID errors wait on decision #8. Do not run it in production.

## Why

Expand All @@ -21,6 +21,17 @@ 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 4 adds

- **Throttle reasons as alert values.** The clock event mask is decoded into one 0 or 1 indicator per reason; an unknown mask gives unknown indicators, never zeros, and bits without an indicator stay in the raw mask, which GPU Health shows.
- **ECC as alert values** ([docs/metrics.md](docs/metrics.md)). New corrected and uncorrected errors since the previous sample are computed by the plugin from two consecutive totals and stored as gauges: unknown for a first sample, a missed read, or a driver reload, so a reset never reads as zero or as a negative count. Retired single-bit and double-bit page counts and the ECC mode are read too. Two more graphs per GPU, ten in all, so Cacti stores them. XID is not collected: no source fits the fixed `nvidia-smi` commands (#8).
- **Thold and Maint** ([docs/alerting.md](docs/alerting.md)). Shipped Thold templates for temperature, power against its limit, the throttle indicators, new uncorrected ECC errors, pending page retirement, and sample age. Every value is a gauge, because Thold 1.8.2 fails on an unknown counter. An end-to-end test with unchanged Thold 1.8.2 and Maint 1.3 shows each threshold fire and restore, across an ECC reset, and Maint suppress it.
- **GPU Health** (GPU View). Per node: freshness, how the last collection ended, Maint state, backend, tool and driver versions, and GPU counts; per GPU: presence, sample age, ECC state, and the raw mask. It reads stored records only.
- **Permissions.** The permission suite covers every page file and action, revocation on the next request, and refusals that disclose nothing.
- **Failure and restore qualification.** Scripted end-to-end runs break the agent, the credentials, the tool, its output, the database connection, and RRD writes, and restore the database from a dump, including one older than the RRD files; a new GPU never inherits another's RRD file ([docs/backup.md](docs/backup.md)).
- **Scale** ([docs/performance.md](docs/performance.md)). A scale test times collection, the script server input, Cacti object creation, a poller cycle, and the health page at a given GPU count; CI runs it at 100 GPUs. The 1,000 and 8,000 GPU measurements are not recorded yet, so no supported GPU count is stated.
- **Operator documentation** ([docs/operations.md](docs/operations.md)): install, upgrade, uninstall, least privilege, unavailable values, and troubleshooting. Changes are listed in [CHANGELOG.md](CHANGELOG.md).

## 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.
Expand All @@ -31,7 +42,7 @@ Out of scope: any command that changes a GPU or node (clocks, power limits, rese
- **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.
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 removes the templates and the XML only when *Remove the plugin's Cacti objects on uninstall* is checked, and never deletes RRD files, devices, graphs, or data sources ([docs/operations.md](docs/operations.md#uninstall)). Nodes on remote data collectors are not collected until phase 3.

## What milestone 2 ships

Expand All @@ -43,13 +54,14 @@ The installing (web server) user must be able to write `<cacti>/resource/script_

### Install for evaluation

These steps install the milestone 3 code to try it. They require Cacti 1.2.31 or later on PHP 8.2 or later.
These steps install the current code to try it; [docs/operations.md](docs/operations.md) has the full operator guide. 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. 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).
5. For alerts, import the shipped Thold templates as [docs/alerting.md](docs/alerting.md) describes.
6. 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).

## How metrics reach Cacti

Expand All @@ -63,7 +75,7 @@ Decision [#7](https://github.com/somethingwithproof/plugin_gpu/issues/7) chose S
| PHP | 8.2 or later; `setup.php` stays parseable on 8.0 so an unsupported runtime gets a refusal instead of a broken Cacti UI |
| NVIDIA | Driver and tool lines to be set by research [#26](https://github.com/somethingwithproof/plugin_gpu/issues/26); DCGM field IDs checked at v3.3.9 and v4.7.0 |
| AMD | `amd-smi` on ROCm releases to be set by research [#26](https://github.com/somethingwithproof/plugin_gpu/issues/26) |
| Thold, Maint | No changes required |
| Thold, Maint | Thold 1.8.2 and Maint 1.3, unchanged, tested end to end ([docs/alerting.md](docs/alerting.md)) |

## Design

Expand Down
1 change: 1 addition & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ path = [
"README.md",
"CONTRIBUTING.md",
"SECURITY.md",
"CHANGELOG.md",
"docs/**",
".github/**",
".editorconfig",
Expand Down
Loading
Loading