Files
nmon/docs/DEVIATIONS.md
jleung 0754268e9e
Some checks failed
ci / lint (push) Has been cancelled
ci / test (ubuntu-24.04-arm) (push) Has been cancelled
ci / test (ubuntu-latest) (push) Has been cancelled
ci / postgres (push) Has been cancelled
ci / openapi (push) Has been cancelled
M6: gate-m6, operations guide, deviations, screenshots
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx9FNLG2CqeBbVGGd9bFsP
2026-10-23 02:15:49 +00:00

15 KiB
Raw Permalink Blame History

Deviations from the spec

Every place the build departs from docs/spec/, with the reason. The spec is the contract; a line here is a conscious, reviewed exception.

# Spec says Build does Why Milestone
1 Fixtures run on snmpsim (Python) via compose internal/simagent, a Go agent that serves standard .snmprec files (v1/v2c/v3, dynamic counters, slow/flaky/toobig). deploy/snmpsim-compose.yml is kept for anyone using the reference simulator. 2,000 agents for the loadtest in one process; no Python in CI; same file format, so real snmpsim recordings still work. M1
2 "Two VictoriaMetrics executables are embedded" One VictoriaMetrics single-node executable per architecture is embedded and run as two processes (hot and long) with different -retentionPeriod. Both stores are the same program; embedding it twice would double the binary size for no gain. M1
3 Libraries: huma, gosnmp, gnmic, go-oidc, bun; standard library elsewhere Also: oklog/ulid (ULIDs), gopkg.in/yaml.v3 (profiles, config), golang.org/x/net (unprivileged ICMP), golang.org/x/crypto (bcrypt, ACME), bun's SQLite (modernc.org/sqlite) and Postgres (pgdriver) drivers, golang/snappy + protobuf (remote write). Each one fills a gap the standard library doesn't cover; each is small and widely used. M1+
4 Integration tests use a VictoriaMetrics container Integration tests run the VictoriaMetrics binary that make fetch-vm downloaded (the same pinned, checksummed one that is embedded). Faster, and it tests the exact binary that ships. M1
5 (not specified) M1 has no auth Until M6, nmon serve requires --insecure-http and has no auth. Auth is M6 in the build order. M1–M5
6 "No MIB file is ever shipped in the repo or the binary"; vendor MIBs are the operator's to fetch MIBs are bundled as a sidecar (user decision, 2026-10-22). All 4,865 LibreNMS MIBs are vendored under mibs/ and shipped in the release tarball (installed to /usr/share/nmon/mibs). None is embedded in the binary, not even the IETF/IANA set. They are read via --mibs-dir (default <data-dir>/mibs, then /usr/share/nmon/mibs). The poller never reads a MIB. Operators get nmon profile new --mib working out of the box while the binary stays small. Each MIB keeps its publisher's terms (see mibs/README.md). M2
7 import-librenms reads includes/definitions/*.yaml and includes/definitions/discovery/*.yaml Reads resources/definitions/os_detection/*.yaml and resources/definitions/os_discovery/*.yaml, with the old paths as a fallback. LibreNMS moved them; the spec's paths no longer exist upstream. M2
8 Real recordings replace synthetic fixtures when available LibreNMS's tests/snmpsim/*.snmprec (2,054 real device recordings) are used by optional tests when NMON_LIBRENMS_DIR points at a checkout. They are never copied into this repo. Real-device coverage without vendoring GPL test data into an Apache-2.0 repo. M2
9 nmon profile import-librenms <repo-path> is an nmon subcommand A separate binary, nmon-librenms-import (cmd/nmon-librenms-import), run offline before nmon. It writes draft profiles that the operator reviews and copies into <data-dir>/profiles/. nmon neither links nor exposes it. User decision (2026-10-22). It keeps the importer out of the product binary and makes "the converter never runs at serve time" structural. M2
10 scripts/openapi-diff fails on an incompatible change (M3 milestone) The differ is the Go package internal/openapidiff (unit-tested, run with go run ./internal/openapidiff/cmd/openapidiff), driven by scripts/openapi-check.sh, which make gate-m3 and the CI openapi job call. A Go package is testable and linted like the rest of the code; the script only fetches the spec at the last m*/v* tag. No new dependency. M3
11 Built assets are embedded from web/dist into internal/webui make web copies web/dist to internal/webui/dist (git-ignored, .gitkeep tracked); a committed internal/webui/placeholder/index.html ("UI not built") is served when dist has no index.html. A tracked dist/index.html would be overwritten by every build and dirty the tree, and a built UI must never be committed. go build still works without node. M3
12 (not specified) Developer tools (backfill, seed-demo) are a separate executable, cmd/nmon-devtools (make devtools builds nmon-devtools), never shipped. It talks to a running nmon over its HTTP API and to the hot store via --hot-url. nmon has no devtools command; depguard and a go list -deps test keep cmd/nmon from linking internal/simagent, internal/fixturegen, internal/fixtures or internal/testutil; nmon profile record uses only the .snmprec format in internal/snmprec. The gate needs 30 days of history without waiting 30 days, and live screenshots need a simulated network. See docs/dev.md. M3
13 (not specified) /docs API reference /docs serves a vendored, pinned swagger-ui-dist 5.17.14 (Apache-2.0, about 1.6 MB) through embed.FS. huma's built-in renderers load their assets from a CDN, which an offline monitor cannot rely on. M3
14 M2 defined provisional poller/health and identity-reviews responses Both were reshaped in M3 to the reviewed UI contract, before any openapi.json existed, so the route freeze starts at m3, the first tag with a checked-in spec. The M2 shapes had no consumer. scripts/openapi-check.sh passes against m2 with a note and diffs for real from m3. M3
15 A single-signal failure (ICMP only or SNMP only) is a warning The warning is held as pending for 5 min before it notifies, and is closed silently if the device goes down meanwhile. Otherwise a real outage whose second signal fails seconds later sends a spurious warning first. M4
16 An unsupported probe is unknown, never failed When ICMP is unsupported (host can't open unprivileged ICMP, or per device), SNMP alone decides down, as with icmp_blocked, and a one-time icmp_unsupported device warning is raised. Otherwise nmon could never declare a device down on such a host, and nobody would notice. M4
17 M6 gate: "the 2,000-device loadtest cycle finishes under 40 s"; the loadtest acceptance lines (200k interfaces in 40 s, memory stable over 30 min, peak RSS/disk/ingest/latency report, backup during load) Skipped (approved by the owner, 2026-10-22: "skip the device load test… put this in prod asap"). The M6 gate checks only that a viewer gets 403 on PUT. Backup/restore is verified on a normal-size dataset instead of under load. Scale is unproven beyond the fixture and gate sizes (24 devices). Time to production. M6
18 Push token format not specified The secret is nmp_<id>_<base32 of 160 random bits>; the row stores a salted SHA-256 (<salt>$<hash>). The id selects the row, so authentication is one primary-key lookup and never scans or compares other tokens. M5
19 rollup_windows status is done or partial A third status, pending, is written before the long-store write begins. A crash between the write and the commit still tells the next run which version number is taken, so it writes v+1. M5
20 v is a version number on rollup series v is on nmon_if_rate_bps_5m, _avg_1h, _max_1h and the gauge series, encoded YYYYMM*1000+n (UTC month of the window, then the version). Numeric, so MetricsQL can compare versions; the month prefix lets retention drop whole months of 5 m series. Readers use internal/longq.LatestVersion. M5
21 Gauge rollups: "a 5 m average, plus a 1 h avg, max and min" Series are named <name>_avg_5m, <name>_avg_1h, <name>_max_1h, <name>_min_1h, with the source labels plus v. The suffix keeps the source name searchable and cannot collide with a polled metric (such names are not rolled up). M5
22 5 m series are deleted past retention.fiveminute Whole calendar months are deleted with delete_series once they ended before now - retention.fiveminute, so 5 m data lives 4 to 5 months. Open-source VictoriaMetrics has one retention per process and no time-ranged delete; the v prefix makes each 5 m series one month. M5
23 Rollup writes go through the write queue Rollup long writes bypass the queue: a synchronous, acknowledged import, then force_flush, then a read-back count. The queue is fire-and-forget (it can drop after 60 s); a window may be recorded done only once the store has it. M5
24 Unreliable (32-bit) interfaces are excluded from p95 and group sums They are also never rolled up, and a graph of one returns no series. A rate from a wrapping counter is wrong whichever tier stores it. M5
25 nmon_group_p95_bps{group, dir, month, members_hash} Group (and interface) p95 records also carry a coverage label. A figure below 90% coverage must never be shown without it. M5
26 Check samples labelled by device nmon_check_up, nmon_check_latency_seconds and nmon_tls_expiry_seconds also carry check (the check id). A device can have several checks. M5
27 Proxmox nodes are devices A node is the existing SNMP device with that name (or sysName), else a new check_only device; its health is the status the API reports. Guests are vm/container devices keyed by pve:<cluster>/<vmid>. cluster/resources has no addresses, so nothing but the name can match a node; a missing SNMP device must not orphan its guests. M5
28 Pushed series carry only device Pushed series also carry push="1" (senders cannot set it). The device page lists what a push sender wrote without guessing from metric names. M5
29 Ingest caps, late p95 months and a stalled rollup "raise an alert" They are rows of the alerts table with rules ingest_<kind>, p95_late, rollup_stalled and no device, kept open until cleared (ingest alarms close 20 min after the last trip). They are not metric rules and have no device; the metric-rule evaluator leaves these rule names alone. M5
30 Proxmox cluster config could carry the token secret Only secret_name exists; the secret is stored encrypted via PUT /api/v1/secrets/{name} and cannot be read back. config.yaml is plain text. M5
31 HTTPS by default; plain HTTP only with --insecure-http (Auth: OIDC only) With --insecure-http and neither auth.oidc nor auth.break_glass_file configured, nmon runs in dev-open mode: every request is the admin principal dev, a loud warning is logged at start and the UI shows "Authentication disabled — development mode". Any start over TLS with no sign-in method configured refuses to start. If either sign-in method is configured, --insecure-http only means plain HTTP and cookies without Secure; authentication stays on. The M1-M5 gates (and local development) run nmon serve --insecure-http with no IdP; M6 must not break them. The refusal for TLS-without-auth keeps the unsafe mode from ever being a production start. M6
32 Settings (retention, alert thresholds, IdP, receivers, outbound allow-list) are edited in the UI and reloaded PUT /api/v1/settings and SIGHUP reload in place: alert receivers, the outbound allow-list, trusted proxies, the nightly backup schedule, disk thresholds and the retired-device purge period. Alert rules and their interval, retention, timezone and sites, Proxmox, checks, auth.oidc, break-glass, session lifetimes, listen address, TLS and the data dir are saved but reported as restart_required. An invalid document is a 422 and changes nothing; the file is rewritten from the validated structure, so comments in a hand-edited config.yaml are lost by a UI save. Those parts are built once at start (stores, evaluators, the OIDC client); rebuilding them live is a larger change than the risk of a restart warrants for v1. M6
33 nmon backup <file> takes an online snapshot nmon backup is a client of the running nmon: it calls POST /api/v1/admin/backup (admin token), nmon runs the backup in a scratch file under <data-dir>/backups/.downloads/, streams it and deletes it, and the client saves it atomically (temp file + rename). The key-included line is printed from the archive's own manifest. nmon restore runs offline and starts the restored stores for a moment to verify series. Only the running process may touch the live stores and the database. M6
34 (not specified) Beyond the spec, additive to the API/CLI: GET /api/v1/me, GET /api/v1/auth/options (public), GET /api/v1/audit (admin), POST /api/v1/admin/backup, POST /api/v1/admin/stores/{name}/restart, POST /api/v1/devices/{slug}/purge, POST /api/v1/devices/import, GET/PUT /api/v1/settings; nmon secret set NAME (stores the OIDC client secret before the first start; it also creates the key on a brand-new install); API tokens (viewer, admin) share /api/v1/tokens with push tokens and have ids like a7 because the two kinds live in different tables. OIDC needs its client secret at start, while the API that stores secrets needs a way to sign in: the CLI breaks the cycle. The audit list makes "every use is logged" checkable. M6
35 Port descriptions imported from CSV Interfaces have a new operator-owned description column (migration 8). The CSV import and the API write it; discovery rewrites ifalias from the device on every run and never touches description. Interface search q matches ifname, ifalias and description. A description typed into ifalias would be overwritten at the next discovery. M6
36 OIDC login with a browser flow; break-glass as a local login No login UI (owner decision). Every route except /auth/*, /healthz and push ingest needs a credential, the SPA's files included: an unauthenticated page load is a 302 to /auth/login?return=<url> (the OIDC flow; the return target must be a same-site path), an API call without credentials is a 401 problem+json. Break-glass is GET /auth/breakglass with HTTP Basic, so the browser's own prompt appears; success sets a session and redirects to return or / (POST /auth/breakglass with JSON stays for scripts). When no IdP is configured the redirect goes to the break-glass prompt. Logout is POST /auth/logout, then /auth/signedout (static HTML). /docs and /openapi* need the viewer role. A missing OIDC client secret at start leaves OIDC off with a warning. The IdP is the login page; a second one would be a second thing to secure. M6
37 Disk guard: "ingest throttled below the reserve" Throttle answers push ingest with 429 + Retry-After below the 5% reserve; the poller keeps writing (its volume is bounded by the inventory). Above 90% used, new series are dropped on the nmon side (poller, push and checks) while known series continue; disk alarms are re-raised each minute while the condition holds and resolve themselves 3 minutes after it clears. VictoriaMetrics series limits are start-up flags; the guard is nmon-side admission. M6