Collectors
What produces metrics · built-ins and how to wire each.
A collector produces metrics on a timer. Every [[collectors]] entry becomes one engine task polling at its interval and shipping values out to rules and adapters.
Anatomy
[[]]
= "cpu" # required, your handle
= "cpu" # defaults to `name` when omitted
= "5s" # how often to poll, default 5s
= {} # reserved, see Labels below
= "" # reserved, see Filtering below
= "" # explicit plugin crate (rare)
[]
# kind-specific options
Same kind, different name lets you run several instances:
[[]]
= "api"
= "http"
[]
= "https://api.example.com/healthz"
[[]]
= "homepage"
= "http"
[]
= "https://example.com"
Reference each via api::http.status and homepage::http.latency in rules.
Built-in kinds
The default build ships these. Plugins extend the list.
| Kind | Cargo feature | What |
|---|---|---|
| cpu | collector-cpu | Per-core and aggregate CPU usage |
| mem | collector-mem | System memory and swap |
| disk | collector-disk | Filesystem usage per mount |
| net | collector-net | Per-interface byte and packet counters |
| load | collector-load | 1m / 5m / 15m load averages |
| uptime | collector-uptime | Seconds since boot |
| temp | collector-temp | Hardware temperature sensors |
| http | collector-http | HTTP probe, status / code / latency |
| tcp | collector-tcp | TCP dial probe |
| dns | collector-dns | DNS resolution probe |
| cert | collector-cert | TLS certificate expiry / validity probe |
| process | collector-process | Per-process status / CPU / memory |
| systemd | collector-systemd | systemd unit ActiveState / SubState (Linux only) |
| exec | collector-exec | Run a shell command, parse one number from its output |
Slim builds
Each built-in is gated behind a Cargo feature on nanook-cli. The default build enables every collector; drop the ones you do not need to shave the binary, the dependency tree, and startup time. To opt in to a custom subset:
The same pattern applies to adapters (adapter-*) and channel actions: action-log, action-exec, action-webhook, action-discord, action-slack. To recover the full out-of-the-box set without re-listing every flag, opt in to one of the umbrella features instead: collectors-default, adapters-default, actions-default.
If you want the full set plus an extra cdylib loaded at runtime, keep the defaults on and add the plugin separately. See Plugins.
Filtering
Set filter on a collector to drop samples before they reach the engine bus. The expression uses the filter sub-language of nanook-expr and can match on name, src, and any label key (including the per-collector labels merged in by the same block).
[[]]
= "net"
= 'iface like "eth*" || iface like "wg*"'
A sample whose filter raises a resolver error (for example an iface reference on a metric that has no iface label) is dropped, matching the "filter didn't match" intuition. Bad filter syntax surfaces at nanook check and at startup as nanook::expr::*.
Labels
Per-collector labels = { ... } are merged onto every emitted sample before the global [labels] block. A label already on the metric wins, then the per-collector entry, then the global default.
[[]]
= "net"
= { = "edge" }
[]
= "node-1"
= "prod"
Probing once
See what a collector returns without booting the whole agent:
Pausing / resuming live
While the agent runs:
See ctl.
Writing your own
A collector is a Rust crate that implements the Collector trait and ships as a cdylib. See Plugins for the build layout and ABI version pinning.