Status: Draft, phase 1 built (see "As built") · Depends on: F03, F05, F07, F08 · Decision: ADR-0016 · Guide: agent.md
A small static binary, added to a Docker image while it is built (or run as a sidecar), that reports the container or host, the containers on a Docker engine, local probes and the services inside the image to the server over HTTP push. The server side is the host.agent ingester plugin.
Phase 1 (built)
cmd/agentwithrun,daemon,check,version.- Collectors:
host,docker,tcp,http,process,redis,postgres,nginx,phpfpm,elasticsearch,nodejs. host.agentplugin, push token, uniqueagent_id, usage weight, Grafana dashboard.Dockerfile.agentand the CI imagemonitoring-agent.
Phase 2 (not built)
- Tenant batch endpoint
POST /ingest/v1/batch(F08) and agent self-enrollment with a one-time token, so one agent can cover many hosts without a check per agent. - More collectors: MySQL/MariaDB, MongoDB, RabbitMQ, memcached, Kafka, HAProxy, Traefik, MinIO, a Prometheus scrape, and an exec collector (Nagios exit codes, ADR-0004).
- Redis TLS;
unix:sockets for more collectors. - Kubernetes: a DaemonSet example and pod labels.
- A signed release binary besides the image.
- One report per interval (default 30 s, minimum 5 s): a JSON document with
agent_id,seq,ts,agent_versionand a list of objects. Each object haskey,kind,name,status(ok,warning,critical,unknown),output,labelsandmetrics(name to number). - The plugin maps metric names to a fixed catalog of slots shared by all object kinds. Unknown names are dropped and counted in the check output. The check's status is the worst object status; thresholds are evaluated per object by the engine.
- Silence is CRITICAL after
missed_countintervals (last-seen rule).agent_idin the report must equal the check's, so a token cannot report for another agent. agent run -- cmdstarts the process first, whatever the agent's own configuration; it forwards signals, reaps orphans as PID 1, reports the process and its exit code, and exits with the process's exit code.
host.agent check config: agent_id (required, unique per tenant, case-insensitive), missed_count (1 to 100, default 3). Objects: host, container:<name>, docker:engine, process:main, process:<name>, tcp:<name>, http:<name>, service:<name>, collector:<name> (agent-side problem). Migration 00026_host_agent.sql adds the unique index.
No new endpoints. POST /v1/devices/{id}/checks with plugin: host.agent returns push_token once; POST /v1/checks/{id}/rotate-token rotates it; reports go to POST /ingest/v1/{check_id}.
- A report becomes host, container and service objects with their own state and incidents (
TestHostAgent). - A report with another agent's ID, a bad token or a malformed body is refused; a rotated token stops the old one; silence is CRITICAL.
agent runpasses the exit code and signals through and starts the process when the agent is misconfigured.- The image is under 25 MB and runs without a shell.
- Billing: one unit per agent regardless of what it watches (weight 2, TBD with billing) or per watched object.
- Batch endpoint shape for a sidecar that watches hundreds of containers (the report is cut at 64 KiB today).
Phase 1 in v0.15.0: see docs/progress.md. Verified by TestHostAgent, the unit tests under internal/agent/... and plugins/hostagent, and a run against real redis, postgres, nginx and Docker containers.