version: "3"
services:
pushgateway:
image: prom/pushgateway:latest
ports:
- "9091:9091"
prom:
image: bitnami/prometheus:latest
# volumes:
# - ./monitor/prometheus.yml:/etc/prometheus/prometheus.yml
command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
ports:
- 9090:9090
depends_on:
- exporter
consul:
image: bitnami/consul:latest
volumes:
- consul_data:/bitnami/consul
ports:
- '8300:8300'
- '8301:8301'
- '8301:8301/udp'
- '8500:8500'
- '8600:8600'
- '8600:8600/udp'
volumes:
consul_data:
driver: local
# exporter:
# image: prom/node-exporter:latest
# ports:
# - "9100:9100"
# network_mode: host
# grafana:
# image: grafana/grafana
# ports:
# - "3000:3000"
# environment:
# - "GF_SECURITY_ADMIN_PASSWORD=admin"
# # - "GF_INSTALL_PLUGINS=alexanderzobnin-zabbix-app"
# restart: "always"
# volumes:
# # - "grafana-etc:/etc/grafana/"
# # - ./grafana/data:/var/lib/grafana:rw
# # - ./grafana/plugins:/var/lib/grafana/plugins:rw
# - /etc/localtime:/etc/localtime
# depends_on:
# - prom
global:
scrape_interval: 5s
scrape_timeout: 5s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: []
scheme: http
timeout: 10s
scrape_configs:
- job_name: node
metrics_path: /metrics
scheme: http
consul_sd_configs:
- server: consul:8500
scheme: http
services: []
relabel_configs:
- source_labels: ["__meta_consul_tags"]
regex: ".*,(prd|dev),.*" # 只采集tag里包含prd或dev的
action: keep
- source_labels: ["__meta_consul_tags"]
regex: ".*,(prd|dev),.*"
replacement: $1
action: replace
target_label: "tag" # 新增tag