- 中央:config/(prometheus,alertmanager,grafana)、apps/(tile-cache,topology-editor) - 边缘:config/(vmagent,blackbox,targets)、apps/(onvif-exporter) - env: TRAEFIK_PROVIDER、prometheus/env.example 详细说明 - 文档:README/doc 重构,EDGE_CACHE 合并到 EDGE_AGENT_CONFIG - targets.csv 更新流程说明,ARCHITECTURE 图收窄 Made-with: Cursor
3.1 KiB
3.1 KiB
监控目标与 targets.csv
边缘监控目标统一由 edge-agent/config/targets.csv 配置,经 update-configs.sh 生成 target-onvif.json、target-ping.json、target-topology.geojson。
更新流程:部署时 deploy.sh 自动从 targets.csv 生成 target-*.json;修改 targets.csv 后需手动执行 cd edge-agent/config && ./update-configs.sh,vmagent 每 5 分钟自动重载 JSON,无需重启。
targets.csv 格式
表头(列顺序固定):
type,ip,name,role,parent,uplink_type,network,device_type,model,location,username,password,onvif_port,lat,lon
| 字段 | 说明 | 适用类型 |
|---|---|---|
| type | ping / onvif / topology |
必填 |
| ip | IP(topology 哑设备可空) | ping, onvif |
| name | 节点唯一名,用于拓扑 parent 引用 | 必填 |
| role | 如 core_switch, access_switch, camera, wireless_bridge, media_converter | 可选 |
| parent | 上联设备 name,用于画拓扑连线 | 可选 |
| uplink_type | 与上联链路类型:fiber / copper / wireless | 可选 |
| network | 如 internal / external | 可选 |
| device_type, model, location | 设备描述;onvif 必填 location、账号等 | onvif |
| username, password, onvif_port | ONVIF 认证与端口(默认 80) | onvif |
| lat, lon | 经纬度(十进制度),Geomap 打点与拓扑 | 可选 |
- ping:有 IP,由 Blackbox Exporter 探测,生成
target-ping.json。 - onvif:有 IP,由 ONVIF Exporter 探测,生成
target-onvif.json;需填 device_type, model, location, username, password。 - topology:仅拓扑节点(可无 IP),不参与抓取;用于生成
target-topology.geojson画点与连线。
示例
type,ip,name,role,parent,uplink_type,network,device_type,model,location,username,password,onvif_port,lat,lon
ping,192.168.2.1,core_sw_1,core_switch,,,internal,,,,,,,22.54,113.98
ping,8.8.8.8,google_dns,dns,core_sw_1,fiber,external,,,,,,,22.55,113.99
topology,,dumb_sw_1,access_switch,core_sw_1,copper,internal,switch,,building_A,,,,22.543,113.988
onvif,192.168.1.100,camera_front,camera,dumb_sw_1,copper,internal,camera,HIKVISION,front_door,admin,pass,80,22.123,113.567
生成配置与拓扑
cd edge-agent/config
./update-configs.sh
update-configs.sh:根据 targets.csv 生成target-onvif.json、target-ping.json、target-topology.geojson(含设备点与 parent 连线)。
监控类型与数据流
| 类型 | Job | Exporter | 配置文件 |
|---|---|---|---|
| 网络 Ping | network-ping | Blackbox | target-ping.json |
| ONVIF | onvif-devices | ONVIF Exporter | target-onvif.json |
| 边缘自身 | prometheus-edge | Prometheus | 内置 |
数据流:目标 → Exporter → prometheus-edge 抓取 → remote_write → 中央 VictoriaMetrics。Grafana 查边缘数据需选 VictoriaMetrics 数据源。
验证
- 边缘 Prometheus(http://localhost:9092):
probe_success{job="network-ping"}、onvif_device_up。 - 中央 Grafana(VictoriaMetrics 数据源):
probe_success{region="workernode_1"}等。