完善中央与边缘部署、远程写入与监控文档
- 增加中央与边缘完整配置和部署脚本 - 引入 VictoriaMetrics 数据源与 remote_write 故障排查说明 - 新增 edge-agent 配置脚本、ONVIF 自建 exporter 与 ping 监控示例 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
70
edge-agent/docker-compose.yml
Normal file
70
edge-agent/docker-compose.yml
Normal file
@@ -0,0 +1,70 @@
|
||||
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:
|
||||
Reference in New Issue
Block a user