Docs / Agent

Docker containers

On Linux the agent finds the host's Docker containers. Each compose service or long-running container becomes a check that alerts when it exits, turns unhealthy, crash-loops or runs out of memory, and the Docker daemon gets a check of its own. Free in every edition.

What it needs

Not supported yet: a TCP socket or a socket proxy (the agent never reads DOCKER_HOST), and Podman. An agent in a container with the host's socket mounted refuses it, because the container's /etc/group has no docker group with the socket's group id; it works once you add one (groupadd -g <gid> docker). Recipes for these come in a later release.

What the agent reads

Only GET requests on the socket: /_ping, /version, the container list, each container's inspect, and Docker's oom events between two past times. An inspect answer includes the container's environment, command and mounts, but the agent drops them while decoding: they are never kept, logged or sent. It never starts, stops or changes a container. Of the labels it keeps only the compose project, service and container number, org.opencontainers.image.version and .revision, uptight.name and uptight.watch.

It lists the running containers every 10 seconds and all of them every minute, on its own, so a hung socket never delays the agent's other checks.

What becomes an item

Two labels let a container speak for itself:

LabelEffect
uptight.name=billing-apiNames the item. Containers of one project, or standalone containers, that share it are grouped as replicas. A name shared by different compose projects is ignored (logged once).
uptight.watch=trueWatch it, whatever its restart policy. If all its containers go, the check is down.
uptight.watch=falseIgnore it.

Which containers are watched

For each container item, the first of these that applies decides:

  1. a decision (Watch or Ignore on Inventory → Containers or Discovered, or the API);
  2. the first matching discovery rule;
  3. the uptight.watch label;
  4. the default: watched when any of its replicas has restart policy always or unless-stopped. Every other container (compose only, on-failure, no) waits for approval, so review apps and CI stacks never page by default.

By default <host>:docker-daemon is watched whenever the agent reports Docker (not with containers.enabled: false). A decision or a rule of kind container-runtime can ignore it. While it is watched, the systemd units docker.service and containerd.service default to ignored ("covered by <host>:docker-daemon"); a decision or rule can still watch them.

A container's check is <host>:container:<identity>, in lower case, with / and every other character outside a-z0-9._- turned into - (shop/web becomes app-01:container:shop-web, uptight.name=Billing API becomes app-01:container:billing-api). It runs every 60 seconds, goes down after 2 failures, recovers after 2, and has severity critical.

When a check goes down or warns

StatusWhen
downNo container is running, paused or restarting (they exited, are dead, or were created and never started); every replica is unhealthy; 6 crash-loop runs in 10 minutes; or all its containers are gone and the watch was chosen (a decision, a rule, uptight.watch=true or an agent_checks entry).
warningSome replicas are stopped or paused; some are unhealthy; 3 crash-loop runs in 10 minutes; it restarted after an out-of-memory kill in the last 10 minutes (read from Docker's oom events); a health check has been starting for more than 15 minutes; or all its containers are gone and it was watched by default. That check is retired an hour later.
upOtherwise, for example running 2/2 · healthy · nginx:1.27 · up 3h.

When the Docker daemon is down

When the socket is gone or refused, or Docker does not answer in time, only <host>:docker-daemon goes down, with the reason. The container checks send nothing: they keep their last status, and their page says "No result since …" with a link to the daemon's check. You get one incident that says why, not one per container.

That holds while the agent keeps running. An agent that starts while the daemon is unreachable (a reboot with Docker not up yet, say) has no container list: chosen container checks keep their last status, and default-watched ones are retired an hour later, as for removed containers. They come back once Docker answers.

Health output and secrets

A container check's page shows the last health-check output of an unhealthy or starting container, at most 200 bytes. On the host, before it is sent, credential shapes are replaced with [redacted] (URL passwords, password=, token=, api_key=, Bearer and Basic values and similar), and then so is every value in the agent's secrets file and its UPTIGHT_SECRET_* variables.

Configuration

On the host: agent.yaml

containers:
  enabled: auto   # auto (the default), true or false
ValueMeans
autoWatch Docker when /var/run/docker.sock exists and qualifies. Report nothing otherwise.
trueThe same, but a missing or refused socket shows <host>:docker-daemon down with the reason.
falseNever connect to the socket. On a host with a qualifying socket the agent reports Docker as disabled: central retires the host's discovered container checks with the reason containers turned off on the agent (containers.enabled: false), and removes <host>:docker-daemon as an ignored item. agent_checks entries of kind container stay and report unknown (containers are off on this host) until you change them.

Agents older than 0.10.0 reject the containers key. See agent configuration.

In the config repository

Discovery rules take kind: container and kind: container-runtime. A container rule may also select by image:

discovery:
  severity: { container: critical, container-runtime: critical }
  rules:
    - { name: ignore-sidecars, action: ignore, kind: container, image: ["oauth2-proxy/*", "datadog/agent"] }
    - { name: shop, action: watch, kind: container, identity: ["shop/*"] }

agent_checks:
  - { name: billing-api, kind: container, target: billing/api, severity: critical, on: { host: ["app-*"] } }

defaults:
  by_type:
    container: { interval: 30s }

Where to see them

Central keeps each check's latest detail (replicas, health, restarts) in memory. After a central restart or failover it is blank until the next result, normally within a minute. Status, history and incidents are not affected. The hour before a removed default-watched container is retired starts again after a central restart or failover, so it goes a little later, never earlier.

Upgrading

  1. Central first. An older central drops the containers a 0.10.0 agent sends, and the agent logs central does not accept containers yet.
  2. Then uptight-web. It shows the Containers tab only once central says it supports containers.
  3. Then the agents. Central gives container checks only to agents 0.10.0 and later.

An upgraded agent on a host with Docker starts watching the containers whose restart policy is always or unless-stopped, and <host>:docker-daemon, at once. To hold that back, commit ignore rules first, one per kind ({ name: no-containers, action: ignore, kind: container } and { name: no-docker-daemon, action: ignore, kind: container-runtime }), or set containers: { enabled: false } on the host.