W Watchflare docs
Cette page n'est pas encore disponible en français. Vous lisez la version anglaise.

Docker container metrics

Enable per-container CPU, memory, and network metrics on Docker hosts.

The agent can collect per-container metrics from Docker and Podman: CPU usage, memory usage, and network I/O. This is opt-in and requires access to the container runtime socket.

Requirements: Docker Engine 23.0+ (API v1.44+) or Podman with a compatible API socket (/run/podman/podman.sock).


Enable at install time

Pass --containers to the install or register command:

bash
curl -sSL https://get.watchflare.io | sudo bash -s -- \
  --token wf_reg_YOUR_TOKEN \
  --host YOUR_HUB_IP \
  --containers

Or when registering manually:

bash
sudo watchflare-agent register \
  --token wf_reg_YOUR_TOKEN \
  --host YOUR_HUB_IP \
  --containers

The --containers flag sets container_metrics = true in agent.conf and adds the watchflare user to the docker group automatically.


Enable on an existing installation

If the agent is already installed and registered, enable container metrics in two steps:

Step 1 — Add watchflare to the docker group:

bash
sudo usermod -aG docker watchflare

Step 2 — Set container_metrics = true in /etc/watchflare/agent.conf:

/etc/watchflare/agent.conf toml
container_metrics = true

Step 3 — Restart the agent:

bash
sudo systemctl restart watchflare-agent

Note

Group membership changes take effect on the next service start. The restart in Step 3 picks up both the group change and the config change.


macOS

On macOS (Docker Desktop or Colima), the agent runs as the user who started the Homebrew service. That user already has access to the Docker socket — no group change is needed.

Pass --containers at registration:

bash
watchflare-agent register \
  --token wf_reg_YOUR_TOKEN \
  --host YOUR_HUB_IP \
  --containers

Then restart the service:

bash
brew services restart watchflare-agent

What is collected

MetricDescription
CPU %Per-container CPU usage relative to all cores
Memory usedCurrent memory consumption
Memory limitContainer memory limit (if set)
Network RXInbound throughput (bytes/s)
Network TXOutbound throughput (bytes/s)

Metrics are collected at the same interval as system metrics (default: 30 seconds) and displayed in the Containers tab on the host detail page.

Note

Container metrics are sent point-in-time and are not buffered in the Write-Ahead Log. If the Hub is unreachable, container metrics for that period are lost — system metrics (CPU, memory, disk, etc.) are preserved and replayed from the WAL on reconnect.


Verify it works

After restarting the agent, check the logs for container collection:

bash
journalctl -u watchflare-agent -n 30

Container metrics appear in the Containers tab of the host detail page within the first 30 seconds. To see detailed collection logs, enable debug logging by setting WATCHFLARE_DEBUG=1.

If no containers appear, check that:

  1. The watchflare user is in the docker group: groups watchflare
  2. Docker is running: docker ps
  3. container_metrics = true is set in agent.conf