How to configure cAdvisor to monitor Docker Containers

From this tutorial you will learn “How to configure cAdvisor to monitor your docker container’s metrics. It is an open source container monitoring tool offered and managed by Google. cAdvisor consists of a single container daemon that collects information about the containers that are running, processes that data, and then exports it.

Specifically, cAdvisor records historical resource usage, resource isolation parameters and network statistics for each container machine-wide. 

monitor docker containers using cAdvisor.

Assume that we have 10.0.0.1 server where docker containers are running.

Note: Please update the docker restart policy on each containers if not configured.

docker update --restart=always container_name

To run the cAdvisor container please run the below command.

sudo docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:ro --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --publish=8080:8080 --detach=true --name=cadvisor google/cadvisor:latest

Once your container start and running you can check the UI in the browser “http://<your-ip>:8080

You can make it secure using Nginx and site username password.

Note: In next article you will learn how to configure Prometheus with Cadvisor and configure alert manager for your containers.

Thank you

Leave a comment