In previous posts we explored why Prometheus and Kubernetes are a perfect match but what about other orchestrators? In this post, we discuss how to set up application and infrastructure monitoring for Docker Swarm with Prometheus and Weave Cloud and cover blackbox monitoring of Docker EE and CE versions of Swarm.
The Docker team plans to integrate Prometheus by exposing Docker engine and container metrics in the Moby project. This feature is under development and you can track its progress under "metrics: prometheus integration road map".
For now the engine metrics are still experimental. If you want to use dockerd-exporter you have to enable the experimental feature and set the metrics address to 0.0.0.0:9323. If you are running Docker with systemd create or edit /etc/systemd/system/docker.service.d/docker.conf file like so:
Apply the config changes with systemctl daemon-reload && systemctl restart docker and check if the docker_gwbridge ip address is 172.18.0.1:
Replace 172.18.0.1 with your docker_gwbridge address in the compose file:
Collecting Docker Swarm metrics with Prometheus is not a smooth process, and because of group_left queries, it tends to become more complex. In the future I hope the Swarm DNS will contain the SRV record for the hostname and Docker engine metrics will expose container metrics replacing cAdvisor all together.