一、安装cadvisor
docker pull google/cadvisor:latest
二、运行容器
docker run -d \--volume=/:/rootfs:ro \--volume=/var/run:/var/run:rw \--volume=/sys:/sys:ro \--volume=/var/lib/docker/:/var/lib/docker:ro \--publish=8088:8080 \--detach=true \--name=cadvisor \--privileged=true \google/cadvisor:latest
若出现如下报错
Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory
执行
mount -o remount,rw '/sys/fs/cgroup'
ln -s /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/cpuacct,cpu
三、访问页面
ip:8088
四、Prometheus集成
vim prometheus.yml
- job_name: cadvisor-106static_configs:- targets: ['192.168.xx.xx:8088']