monit-docker

MONIT-DOCKER / v0.0.64

Reference and troubleshooting

Check configuration, Docker access and data freshness in that order.

Option order

monit-docker -c ./monit-docker.yml --name 'web*' stats --output json
monit-docker cron --help
monit-docker serve --help

-c, --client, --name, --image, --label, --id and --ctn-group are global options. --interval, --state-file and rules follow their subcommand.

Useful exit codes

CodeMeaning
0Completed successfully
2Invalid arguments
110Invalid configuration or command
114No selected containers
115Incomplete collection
116Action failure
117State lock already held
118Invalid or inaccessible state
170 / 180Docker connection or API error

monit --rsc status has its own status codes: 0 for running, 50 for exited. Do not interpret these as execution codes for other commands.

Quick diagnosis

  1. Run check-config with your aliases and rules.
  2. Check docker ps -a as the account running the agent. A remote Docker CLI context does not imply that the Python client uses the same connection.
  3. Run stats --output json with the same selectors.
  4. Inspect /v1/status, /readyz and logs. HTTP 503 means not ready, not necessarily that the HTTP server stopped.
  5. Check state directory permissions and the process holding its lock.

Common pitfalls

No container metrics: nothing matches, collection failed or the snapshot is stale. Prometheus cannot reach localhost: inside another container, localhost refers to that container; use the agent’s Compose service name.

A rule is waiting: inspect cooldown and trigger-after. Changing the rule, container or timing parameters resets observation. State schema 2 used for trigger-after cannot be read by older versions (code 118).

Uncertain manual action: inspect its result before retrying. An accepted request or network timeout does not prove the Docker action completed.

When reporting an issue, include version, a redacted command, exit code and relevant logs. Remove tokens, passwords and webhooks.