Host Metrics
Sample every host in a swamp fleet — disk, network IO, load and memory — and push each sample to the swamp-managed OpenTelemetry system, every 15 minutes. WHAT IT DOES
The missing reporting half of a swamp fleet's host telemetry. It reuses
@aaronge/host-health for the local disk (df), load, memory and thermal
reads, and adds the two pieces host-health lacks: network IO counters
(/proc/net/dev) and an OTLP push. listWorkers materialises the
connected worker pool as ordinary data; a scheduled workflow fans a
per-host sample out over every worker (dispatched to that worker, so it
reads that host's /proc) plus the serve host itself, then emit resolves
the OTLP endpoint and bearer token from the @svendowideit/otel-settings
contract and POSTs one log record plus gauges — including the change in /
free space since the previous sample. Prefer it over per-host scripts or a
second metrics agent: the read methods already exist, the fleet list comes
from swamp itself, and a host's whole report is one model instance.
INSTALL
swamp extension pull @svendowideit/host-metricsDEPENDENCIES
@aaronge/host-health (the disk/load/memory/thermal reads this model
consumes, pulled separately) and a rendered @svendowideit/otel-settings
contract (the otel model) with a reachable OTLP gateway. Linux only
(host-health is Linux-only). Without the contract, emit is a no-op that
records why.
RUN
# Sample this machine once — network counter, then the fleet report.
swamp model @svendowideit/host-metrics method run readNetwork host-metrics-host
swamp model @svendowideit/host-metrics method run emit host-metrics-host \
--input healthModel=host-health-host
# List the swamp worker pool as ordinary data (run on the orchestrator).
swamp model @svendowideit/host-metrics method run listWorkers host-metrics-fleet
swamp data query 'modelName == "host-metrics-fleet" && name == "workers"' --select content
# The scheduled pipeline: sample the serve host and every attached worker
# every 15 minutes and push each to OTel (run through `swamp serve`).
swamp workflow run @svendowideit/host-metrics-fleet --server ws://127.0.0.1:9090CONFIGURE
Global arguments (set at model creation with --global-arg key=value):
healthInstancePrefix per-host host-health instance prefix (host-health-)
otelModel @svendowideit/otel-settings model (otel)
otelVaultName vault holding the OTLP bearer token (empty)
otelTokenRef vault/env key for the bearer token (OTEL_EXPORTER_OTLP_TOKEN) Method arguments: readNetwork and listWorkers take none. emit takes
host, healthModel, endpoint, mesh, otelModel, otelVaultName and otelTokenRef.
The @svendowideit/host-metrics-fleet workflow takes otelModel,
otelVaultName and otelTokenRef, and reads the worker list from listWorkers.
WHAT IT INSTALLS
Nothing on the host — no services, daemons, cron triggers or webhooks. It
reads /proc and calls df through @aaronge/host-health, writes swamp
resources, and POSTs to the collector. The schedule is a swamp trigger
evaluated by swamp serve.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| name? | string | Model instance name (supplied by swamp). |
| healthInstancePrefix? | string | Prefix used to derive the per-host @aaronge/host-health instance name |
| otelModel? | string | Default @svendowideit/otel-settings model for `emit`. |
| otelVaultName? | string | Default vault holding the OTLP gateway bearer token for `emit`. |
| otelTokenRef? | string | Default vault/environment key for the OTLP gateway bearer token. |
| Argument | Type | Description |
|---|---|---|
| host? | string | Host name to attribute the OTLP sample to. Empty detects the local |
| endpoint? | string | OTLP/HTTP base URL overriding both the settings contract and any global. |
| mesh? | string | Contract mesh to use for this emit. |
| otelModel? | string | Name of the @svendowideit/otel-settings model supplying the contract. |
| otelVaultName? | string | Vault holding the OTLP gateway bearer token (empty = none). |
| otelTokenRef? | string | Vault/environment key for the OTLP gateway bearer token. |
| healthModel? | string | Name of the per-host @aaronge/host-health model instance whose |
Sample every host in a swamp fleet — the serve (orchestrator) host and every worker attached to it — and push each sample to the swamp-managed OpenTelemetry system, every 15 minutes. One pass per host: host-health's `readFilesystems` (disk, incl. / free bytes), `readLoad`, `readMemory`, this extension's `readNetwork` (/proc/net/dev IO counters + deltas), then `emit` (one OTLP log record plus gauges, including the change in / free space since the previous snapshot). Fan-out: `listWorkers` mater
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License2/2earned
- Verified public repository2/2earned
Spawns a subprocess with Deno.Command().
- models/host_metrics.ts:700 — no reason given
- models/host_metrics.ts:731 — no reason given