# 启动cadvisor容器
docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=48080:8080 \
--detach=true \
--name=cadvisor \
--restart=always \
google/cadvisor:latest
# 防火墙放行
firewall-cmd --add-port=48080/tcp --permanent
firewall-cmd --reload
# 修改加入内容
vi prometheus.yml
scrape_configs:
- job_name: docker
static_configs:
- targets:
- ip:48080
labels:
instance: docker_name
# 重启Prometheus
# 如果你是systemd管理
systemctl restart prometheus
如果你是supervisor管理
supervisorctl restart prometheus