Files
nmon/docs/DEVIATIONS.md

10 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