Using CAdvisor To Monitor Containers
- Launch cAdvisor:
$ 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=8000:8080 \ --detach=true \ --name=cadvisor \ google/cadvisor:latest
- List available containers to confirm it’s working:
$ docker ps
- Update the Prometheus config:
$ sudo $EDITOR /etc/prometheus/prometheus.yml - job_name: 'cadvisor' static_configs: - targets: ['localhost:8000']
- Restart Prometheus:
$ sudo systemctl restart prometheus