Files
nmon/internal/backup/doc.go
Vibe Coder c4d14a67d1 Add the optional IEEE vendor registry for MAC addresses and the l2/oui settings
The owner asked to see the vendor of each MAC where the IEEE registry can be
fetched, and never to depend on it. internal/oui downloads MA-L, MA-M and MA-S
weekly through the outbound allow-list (timeouts, a size cap and a row-count
sanity check, so a truncated or wrong download keeps the previous file), stores
one checksummed, atomically written file in <data-dir>/oui that nmon backup
includes, and looks MACs up by the longest prefix. A missing registry only
leaves the vendor empty. `nmon oui import DIR|FILE` loads the CSVs offline, and
the Ansible role can ship them next to the MIB sidecar.

internal/hostaddr parses the MAC, prefix, IP and CIDR forms the lookup accepts
and classifies a MAC as global, local or multicast. config gains the l2 and oui
sections (validated here; the L2 job that reads l2 follows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4PdJUPrakM8fHvN8jYv2x
2026-10-24 01:30:11 +00:00

20 lines
1.2 KiB
Go

// Package backup writes and restores nmon's one-file backup.
//
// A backup is a tar archive holding a consistent copy of every piece of state:
//
// inventory.db SQLite VACUUM INTO copy of the inventory (SQLite deployments), or
// inventory.jsonl the engine-neutral JSON-lines export (Postgres/MySQL; format in internal/store)
// hot/..., long/... the metric stores' own snapshots (/snapshot/create), as the store's data layout
// config.yaml, profiles/... settings and operator profiles
// oui/registry.gz the IEEE vendor registry (reference data, optional)
// secret.key the encryption key file, only with IncludeKey
// MANIFEST.json always the last entry
//
// The manifest lists every other entry with its size and SHA-256, so a truncated or damaged archive
// cannot restore: it is written last, which makes "manifest present and every entry matches" the proof of
// a complete archive, including after power loss. Backup writes to a temporary file beside the target,
// syncs it and renames it, so a failure never leaves a partial file under the final name.
//
// Copying the data folder while nmon runs is not a backup: the stores and the database are mid-write.
package backup