Adapters
Where metrics go · Prometheus, statsd, file, stdout, webhook.
An adapter exports metrics to an external system: a /metrics endpoint, statsd, a file, a webhook.
Anatomy
[[]]
= "scrape" # required handle
= "prometheus" # defaults to `name` if omitted
= "" # nanook-expr filter on metric name / labels
= "" # explicit plugin crate (rare)
[]
# kind-specific options
filter scopes what each adapter sees. Two adapters can run side-by-side, one shipping CPU stats, the other HTTP probes.
[[]]
= "metrics"
= "prometheus"
= 'name like "cpu.*" || name like "mem.*"'
[]
= 9090
[[]]
= "http-log"
= "file"
= 'name like "http.*"'
[]
= "/var/log/nanook/http.jsonl"
Built-in kinds
| Kind | Cargo feature | What |
|---|---|---|
| prometheus | adapter-prometheus | Serve a /metrics endpoint for scrapes |
| statsd | adapter-statsd | UDP push to a vanilla statsd receiver |
| dogstatsd | adapter-statsd | UDP push to a Datadog dogstatsd receiver (label-aware) |
| file | adapter-file | Append JSONL or CSV to a file |
| stdout | adapter-stdout | Print to stdout, useful for debugging |
| webhook | adapter-webhook | POST batches to an HTTP endpoint |
| pulse | adapter-pulse | Serve nanook's native binary frames over HTTP |
Drop adapters you do not need with --no-default-features on nanook-cli and an explicit feature list. See Collectors → Slim builds for the pattern.
Filtering tricks
The filter DSL has name, src, and label keys as pseudo-fields:
# only the api collector's metrics
= 'src is "api"'
# everything except debug
= 'name not like "*.debug"'
# specific interfaces
= 'iface like "eth*"'
Writing your own
An adapter is a Rust crate that implements the Adapter trait and ships as a cdylib. See Plugins.