version: '3.9'
networks:
monitor:
driver: bridge
services:
prometheus:
image: prom/prometheus:v2.28.1
container_name: prometheus_gpe
hostname: prometheus
restart: always
volumes:
- /data/gpe/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- /data/gpe/prometheus/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
ports:
- "9090:9090"
networks:
- monitor
alertmanager:
image: prom/alertmanager:v0.22.2
container_name: alertmanager_gpe
hostname: alertmanager
restart: always
volumes:
- /data/gpe/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
ports:
- "9093:9093"
networks:
- monitor
grafana:
image: grafana/grafana:8.0.6
container_name: grafana_gpe
hostname: grafana
restart: always
volumes:
- /data/gpe/grafana/data:/var/lib/grafana
ports:
- "3001:3000"
networks:
- monitor
prometheus.yml和alertmanager.yml,这两个文件直接docker启动prometheus和alertmanager然后使用容器复制命令复制出来
网友评论