Files
Distributed-Prometheus/edge-agent/docker-compose.yml
Super User 95a09fd9d8 完善中央与边缘部署、远程写入与监控文档
- 增加中央与边缘完整配置和部署脚本
- 引入 VictoriaMetrics 数据源与 remote_write 故障排查说明
- 新增 edge-agent 配置脚本、ONVIF 自建 exporter 与 ping 监控示例

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 04:24:40 -05:00

71 lines
2.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
# ========== 边缘必选 ==========
# 1. 边缘 Prometheus抓取 + remote_write 推到中央 VictoriaMetrics
prometheus-edge:
image: prom/prometheus:latest
container_name: prometheus-edge
restart: unless-stopped
environment:
- CENTRAL_SERVER_HOST=${CENTRAL_SERVER_HOST:-192.168.1.10}
- CENTRAL_SERVER_PORT=${CENTRAL_SERVER_PORT:-8428}
volumes:
- prometheus-edge-data:/prometheus
- ./prometheus-edge/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./config/onvif-targets.json:/etc/prometheus/onvif-targets.json:ro # 挂载静态设备列表
- ./config/ping-targets.json:/etc/prometheus/ping-targets.json:ro # 挂载Ping目标列表
mem_limit: "256m"
cpus: "2.0"
ports:
- "9092:9090" # 改为9092避免与中央服务器冲突
# 本机同机部署时,容器内通过 host.docker.internal 访问宿主机中央服务
extra_hosts:
- "host.docker.internal:host-gateway"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.retention.time=1h'
- '--web.enable-lifecycle' # 启用配置重载API
networks:
- monitoring_net
# ========== 可选容器(按需启用)==========
# 2. ONVIF Exporter可选使用本项目自建
# 启用docker compose --profile onvif up -d --build会构建 edge-agent/onvif-exporter 并启动)
# 配置文件config/onvif-targets.json与 targets.csv 中 onvif 行一致,由 update-configs.sh 生成)
onvif-exporter:
profiles:
- onvif
image: onvif-exporter:local
build:
context: ./onvif-exporter
dockerfile: Dockerfile
container_name: onvif-exporter
restart: unless-stopped
environment:
- EXPORTER_PORT=9600
- TARGETS_FILE=/config/targets.json
volumes:
- ./config/onvif-targets.json:/config/targets.json:ro
mem_limit: "128m"
cpus: "1.5"
networks:
- monitoring_net
# 3. Blackbox Exporter必选网络 Ping 探测)
blackbox-exporter:
image: prom/blackbox-exporter:latest
container_name: blackbox-exporter
restart: unless-stopped
volumes:
- ./blackbox/config.yml:/etc/blackbox_exporter/config.yml:ro
mem_limit: "64m"
cpus: "0.5"
networks:
- monitoring_net
networks:
monitoring_net:
driver: bridge
volumes:
prometheus-edge-data: