一、安装google的cadvisor
docker run -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys:ro -v /var/lib/docker/:/var/lib/docker:ro -p 8091:8080 --detach=true --privileged=true --name=cadvisor --restart=always google/cadvisor:latest
官方github地址是:https://github.com/google/cadvisor
它是采用go语言开发,由google公司开源。
如果安装过程中出现了如下报错,请先删除原先的镜像。
docker: Error response from daemon: Conflict. The container name "/cadvisor" is already in use by container "5e558221cf4b29f5b0224b85120412c949d28845eab5d23fb19abdf794e7cb0d". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
docker rm 5e558221cf4b29f5b0224b85120412c949d28845eab5d23fb19abdf794e7cb0d
二、前端界面
http://192.168.10.150:8091/
image.png
三、prometheus接入
vi prometheus.yml
- job_name: 'cAdvisor'
metrics_path: '/metrics'
static_configs:
- targets: ['192.168.10.150:8091']
# 热加载使之生效
curl -XPOST http://127.0.0.1:9090/-/reload
四、grafana配置界面
去官网下载地址:https://grafana.com/grafana/dashboards 筛选并选择模板ID是893。
image.png














网友评论