注意项
- version 版本号3.5
- 采集数据如果使用ingress模式,多个节点爬取的数据是一样的. 必须采用hosts模式
- host模式必须为如下格式:
ports:
- target: 9100
published: 19100
mode: host
version: '3.5'
networks:
monitor-net-host:
external:
name: host
services:
node-exporter:
image: prom/node-exporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- --collector.filesystem.ignored-mount-points
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
ports:
- target: 9100
published: 19100
mode: host
restart: always
deploy:
mode: global
cadvisor:
image: google/cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
ports:
- target: 8080
published: 18080
mode: host
restart: always
deploy:
mode: global