|
| 1 | +#### About `check_docker` |
| 2 | + |
| 3 | +`check_docker` checks the state of docker containers via the local daemon |
| 4 | +socket (`/var/run/docker.sock` on Linux, the `\\.\pipe\docker_engine` named |
| 5 | +pipe on Windows; configurable via the `endpoint` setting or `host=`). It works |
| 6 | +against any daemon speaking the docker API, including podman's compatibility |
| 7 | +socket. |
| 8 | + |
| 9 | +Three ways to use it: |
| 10 | + |
| 11 | +* `container=<name>` (repeatable) — the "is my container running" mode: only |
| 12 | + the named containers are checked, and a name the daemon does not know gets |
| 13 | + the synthetic state `missing`, so it trips the default critical instead of |
| 14 | + silently disappearing from the listing. |
| 15 | +* No arguments — lists running containers; nothing trips the default |
| 16 | + thresholds, so this is an inventory-style check. |
| 17 | +* `all=true` — also includes stopped containers (like `docker ps -a`); any |
| 18 | + non-running container then trips the default critical |
| 19 | + (`container_state != 'running'`), so combine it with `filter=` on hosts |
| 20 | + where exited one-shot containers are expected. |
| 21 | + |
| 22 | +Available keywords (for `filter=` / `warning=` / `critical=` / syntax): |
| 23 | + |
| 24 | +| Keyword | Description | |
| 25 | +|-------------------|------------------------------------------------------------------------------| |
| 26 | +| `names` | Container name(s), comma separated | |
| 27 | +| `container_state` | `created`, `restarting`, `running`, `removing`, `paused`, `exited`, `dead` or `missing` | |
| 28 | +| `status` | Human readable status, e.g. `Up 3 hours (healthy)` | |
| 29 | +| `health` | Health-check state: `healthy`, `unhealthy`, `starting`, or empty without a health check | |
| 30 | +| `image` | Image the container was created from | |
| 31 | +| `image_id` | Id of that image | |
| 32 | +| `id` | Container id | |
| 33 | +| `command` | Command the container runs | |
| 34 | +| `ip` | First IP address on any attached network | |
| 35 | +| `ports` | Published/exposed ports, e.g. `0.0.0.0:8080->80/tcp` | |
| 36 | +| `labels` | Container labels as `key=value`, comma separated | |
| 37 | +| `created` | When the container was created (date) | |
| 38 | + |
| 39 | +The daemon endpoint is restricted to a local named pipe / absolute socket path: |
| 40 | +a UNC path in `host=` would make a Windows host authenticate to a remote SMB |
| 41 | +server with the service account, so anything non-local is refused outright. |
0 commit comments