diff --git a/docs/PLAN.md b/docs/PLAN.md index 0dbbb19..832c11b 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -169,16 +169,16 @@ Evidence for decision #7 is collected in [research/collection-path.md](research/ ## Collection paths -Vendor tools run on the GPU node. The Cacti poller that reads the data is a process on the main server or on a remote collector. The decision about how the data gets from one to the other is open (#7) because each path moves the trust boundary: +Vendor tools run on the GPU node. The Cacti poller that reads the data is a process on the main server or on a remote collector. Each path moves the trust boundary. The decision (#7) is option B, SNMP `extend`, recorded in [ADR 0008](decisions/0008-collect-through-snmp-extend.md); A and C stay possible later backends: | Path | How it works | Strengths | Costs | |---|---|---|---| | A. Cacti poller on the node | The plugin runs the vendor tool on a host that is a Cacti main server or remote data collector. | No network credential; no new protocol. | Every GPU node needs a full Cacti collector. | | B. SNMP `extend` | `snmpd` on the node runs a fixed command; Cacti reads the output tables. | Nothing to install beyond `snmpd` configuration; Cacti already polls SNMP. | Output tables are indexed by line, so the UUID must be in the output; run-as user and timing unverified (#22). `snmpd` becomes a command runner. | | C. Scrape `dcgm-exporter` | Plugin makes an HTTP request to an operator-configured URL. | Reuses an NVIDIA-supported exporter. | NVIDIA only; needs DCGM; outbound request boundary; freshness bounded by the exporter's interval. | -| D. SSH from the poller | The poller logs in and runs the tool. | Works anywhere SSH works. | A credential store and a remote command path. Not proposed. | +| D. SSH from the poller | The poller logs in and runs the tool. | Works anywhere SSH works. | A credential store and a remote command path. Rejected (ADR 0008). | -Whatever the decision, the same rules apply: no operator input reaches a command line, the plugin never uses elevated privilege, and the script server input reads only the plugin's cache (ADR 0007). The collector sits behind an interface so the nvidia-smi, DCGM, and amd-smi backends and the transports are independent choices. The architecture below draws the interface and not a chosen path. +Whatever the decision, the same rules apply: no operator input reaches a command line, the plugin never uses elevated privilege, and the script server input reads only the plugin's cache (ADR 0007). The collector sits behind an interface so the nvidia-smi, DCGM, and amd-smi backends and the transports are independent choices. The architecture below draws the interface; the first backend reads SNMP `extend` output. ## Architecture @@ -227,7 +227,7 @@ Cacti keeps history by data query index. An index that changes meaning attaches Rules, tested by fixtures (REQ-ID-001 to 006): -- A new UUID at a known node, index, and bus ID creates a new GPU record flagged as a possible replacement. It never inherits history. As built in M2, the flag is raised when the bus ID of an unreported record at the same node matches, whatever the index, because the index can change at any boot; this flags every case the rule names and some it does not. +- A new UUID at a known node, index, and bus ID creates a new GPU record flagged as a possible replacement. It never inherits history. As built in M2, the flag is raised when the bus ID of an unreported record at the same node matches, whatever the index, because the index can change at any boot; this flags every case the rule names and some it does not. The owner accepted the broader rule on 2026-11-15: a flag only asks the operator to confirm, while a missed replacement would attach history to the wrong card. - A UUID seen at a different node is recorded as moved only when an operator confirms. - A GPU missing from collection is marked absent after N consecutive successful collections, never deleted automatically, and keeps its index, data sources, and RRD files. - A failed collection, a tool error, or an empty result never marks GPUs absent. @@ -359,7 +359,7 @@ Plugin code is object-oriented wherever Cacti's plugin contract allows it. Cacti Plugin tables hold node mappings, GPU records, the observation cache, and health. They are created and upgraded with Cacti's tracked plugin table API, and the stored plugin version changes only after a migration succeeds. The collector runs from `poller_bottom` through `exec_background()` as one `register_process_start()` process per poller, with a time budget. Runs are idempotent. -Disabling the plugin stops jobs and leaves devices, graphs, and RRD files untouched. Uninstalling offers an export, then asks separately whether to drop plugin tables and whether to remove plugin-created Cacti objects. Cacti 1.2 gives a plugin no prompt during uninstall, so as built in M2 the questions are settings answered before uninstalling: *Keep Plugin Tables on Uninstall* (default on), with the export on the GPU Nodes page. M2 creates no Cacti objects, so the second question arrives with the milestone that creates them. The plugin never changes anything on a GPU node. Backup documentation covers the Cacti database and the RRD directory. A restore must not attach an RRD file to a different UUID, which is a release test. +Disabling the plugin stops jobs and leaves devices, graphs, and RRD files untouched. Uninstalling offers an export, then asks separately whether to drop plugin tables and whether to remove plugin-created Cacti objects. Cacti 1.2 gives a plugin no prompt during uninstall, so as built in M2 the questions are settings answered before uninstalling: *Keep Plugin Tables on Uninstall* (default on), with the export on the GPU Nodes page. If the tables are to be kept but cannot be untracked from Cacti's plugin table list, the uninstall stops with an error and the plugin stays installed, because Cacti ignores the uninstall function's return value and would otherwise drop them (accepted by the owner on 2026-11-15). M2 creates no Cacti objects, so the second question arrives with the milestone that creates them. The plugin never changes anything on a GPU node. Backup documentation covers the Cacti database and the RRD directory. A restore must not attach an RRD file to a different UUID, which is a release test. ## Performance @@ -427,7 +427,7 @@ Milestone size estimates (ranges from measured reference plugins, no durations) | Decision | Options | Needed before | Decided by | |---|---|---|---| -| Collection path (#7) | Poller on node, SNMP extend, dcgm-exporter scrape | Milestone 2 | M1 measurements | +| Collection path (#7) | Decided 2026-11-15: SNMP extend ([ADR 0008](decisions/0008-collect-through-snmp-extend.md)) | Milestone 3 | Owner | | XID source (#8) | DCGM field, kernel log, none in phase 1 | Milestone 3 | #16 | | Common metric model (#9) | Common core plus vendor extensions (proposed); vendor-specific templates | Milestone 3 | Cacti maintainers | | Attach to existing devices (#10) | Existing device (proposed); plugin-owned devices | Milestone 3 | Cacti maintainers | diff --git a/docs/decisions/0008-collect-through-snmp-extend.md b/docs/decisions/0008-collect-through-snmp-extend.md new file mode 100644 index 0000000..97b48ce --- /dev/null +++ b/docs/decisions/0008-collect-through-snmp-extend.md @@ -0,0 +1,29 @@ +# 0008. Collect through SNMP `extend` on the GPU node + +Status: Accepted (2026-11-15). Decides #7. + +## Context + +GPU metrics come from `nvidia-smi` or `amd-smi` on the GPU node, and the Cacti poller is usually another host. The plan listed four paths (poller on the node, SNMP `extend`, a `dcgm-exporter` scrape, SSH) and left the choice to the milestone 1 research. That research ([collection-path.md](../research/collection-path.md), [snmp-extend.md](../research/snmp-extend.md)) excluded none of A to C and found that none dominates. It confirmed from the net-snmp 5.9.5.2 source that an `extend` command runs as the user `snmpd` runs as, root unless `agentuser` or `-u` is set. It also confirmed that stderr is merged into the output, that output is capped at 100 KiB and 1024 lines, and that `snmpd` can wait for a child that never exits with no timeout. + +## Decision + +- The primary path is option B. The node administrator configures one `extend` entry per vendor tool in `snmpd.conf`, and the plugin reads `NET-SNMP-EXTEND-MIB` through Cacti's SNMP polling of the node's device, with the credentials Cacti already holds for that device. +- The entry runs the vendor tool with a fixed argument vector and no shell (`extend` without `-execType sh`), under `timeout` so that the child always exits. For example, `/usr/bin/timeout` with a bound below the cache window, then the tool with its query arguments. The plugin documents the exact lines; it sends no input to the node. +- `snmpd` must run as an unprivileged user (`agentuser`, or `-u`). The plan's fields need no privilege ([privileges.md](../research/privileges.md)). The documentation requires it; the plugin cannot see which user ran the command, and the live check in #22 records each distribution's default. +- SNMPv3 with authentication and privacy is the documented default. v1 and v2c work but are documented as plaintext. +- The GPU UUID comes from the output line, never from the SNMP index (ADR 0003). Output is parsed by field position and validated, and a short row, extra field, merged stderr text, a nonzero `nsExtendResult`, or truncation at the output cap is an error, not a value (ADR 0007). +- The collector stays behind its backend interface, so a later backend (DCGM, a poller on the node) can be added without changing identity or storage. + +## Consequences + +- Every GPU node needs `snmpd` with the extend lines. Sites that already monitor nodes over SNMP add only those lines. +- `snmpd`'s 5 s default cache and the command's run time set the freshest possible sample; the measurement rules in the plan apply to the sample, not the poll time. +- The 100 KiB and 1024-line caps are far above one node's output (one line per GPU), so truncation is treated as an error rather than planned for. +- The live checks in snmp-extend.md (run-as user per distribution, effect of a slow command on `snmpd` responsiveness) gate the phase 1 release, not M3 development. + +## Alternatives rejected + +- **A. Cacti poller on the node.** No network path, but a full Cacti collector on every GPU node. Kept as a later backend for sites that already run one. +- **C. Scrape `dcgm-exporter`.** NVIDIA only, needs DCGM and exporter configuration for ECC and throttle fields, renamed metrics at 4.9.0, and makes the plugin issue outbound HTTP requests. Kept as a later backend (milestone 5). +- **D. SSH from the poller.** The poller would hold a private key for every GPU node and need a remote command path. A forced command limits what runs but not the key store. Rejected, as in the plan. diff --git a/docs/decisions/README.md b/docs/decisions/README.md index a4e6551..4f74b57 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -11,5 +11,6 @@ Each record captures one architecture decision: its context, the decision, its c | [0005](0005-use-cacti-remote-collectors.md) | Reach remote GPU nodes through Cacti remote data collectors, not a custom agent | Accepted | | [0006](0006-php-82-floor-with-80-parse-guard.md) | Require PHP 8.2, keep entry points parseable on PHP 8.0 | Accepted | | [0007](0007-run-vendor-tools-with-fixed-argument-lists.md) | Run vendor tools with fixed argument lists, no shell, and no elevated privilege | Accepted | +| [0008](0008-collect-through-snmp-extend.md) | Collect through SNMP `extend` on the GPU node | Accepted | -Open decisions are tracked as issues labelled `type: decision`. The collection path (#7) is the largest one and is not decided. +Open decisions are tracked as issues labelled `type: decision`. The collection path (#7) was decided on 2026-11-15 in record 0008.