mkdir -p /usr/local/node_exporter/prom
1、docker-compose.yml
cadvisor:
image: google/cadvisor:latest
container_name: cadvisor
restart: unless-stopped
ports:
- '8080:8080'
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: unless-stopped
ports:
- '9100:9100'
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.textfile.directory=/node_exporter/prom'
- '--collector.systemd'
- '--collector.systemd.unit-whitelist=(docker|sshd|rsyslog).service'
volumes:
- /proc:/host/proc
- /sys:/host/sys
- /var/run:/var/run:rw
- /:/rootfs
- /usr/local/node_exporter/prom:/node_exporter/prom
2、pip install docker-compose
docker-compose -f docker-compose.yml
3、prometheus 修改配置文件 prometheus.yml
重启docker: docker restart prometheus
网友评论