首先在你的 prometheus 中的
scrape_configs
加入以下設定:(要挑對區段加喔)scrape_configs: - job_name: cadvisor scrape_interval: 5s static_configs: - targets: - cadvisor:8080 # ip 要自己改
另外在 cluster 外部,你要監控的機器上加以下
docker-compose.yaml
version: '3.2' services: cadvisor: privileged: true image: gcr.io/cadvisor/cadvisor:latest container_name: cadvisor ports: - 8080:8080 volumes: - /:/rootfs:ro - /var/run:/var/run:rw - /sys:/sys:ro - /var/lib/docker/:/var/lib/docker:ro depends_on: - redis redis: image: redis:latest container_name: redis ports: - 6379:6379
再來應該就可以給 prometheus 抓資料了!