Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker stats in Swarm mode?

Im trying to setup docker in swarm mode and monitor the resource utilization of all the services/containers running in the swarm.

Docker stats on the manager node doesnt seem to show the resource utilization on the worker nodes.

Is there any way I can do this?

Thanks.

like image 311
grattttt Avatar asked Aug 27 '17 16:08

grattttt


People also ask

How do I get docker container metrics?

You can use the docker stats command to live stream a container's runtime metrics. The command supports CPU, memory usage, memory limit, and network IO metrics. The docker stats reference page has more details about the docker stats command.

Is docker swarm still alive?

DEPRECATION NOTICEClassic Swarm has been archived and is no longer actively developed. You may want to use the Swarm mode built into the Docker Engine instead, or another orchestration system.

Can docker swarm auto scale?

Docker swarm does not support the autoscaling concept. You need to use another solution for that, like docker-machine to create machines on your infrastructure and link these to the existing Swarm cluster.


2 Answers

Try Ansible:

ansible docker -a "docker stats --no-stream"

Where you setup your "docker" nodes in /etc/ansible/hosts

like image 178
Andrew G Avatar answered Oct 23 '22 11:10

Andrew G


There's no direct way to retrieve all container stats of a given service in a Swarm. You'll probably have to use more steps to discover all tasks of a service, all node addresses, and each container id. The engine api docs should help you getting started. If you need some inspiration, I'd suggest you to peek into such overview dashboards like the https://github.com/charypar/swarm-dashboard or the https://github.com/dockersamples/docker-swarm-visualizer.

like image 35
gesellix Avatar answered Oct 23 '22 11:10

gesellix