Files
Distributed-Prometheus/doc/TARGETS_AND_MONITORING.md
User 650e5145f1 refactor: 边缘节点与配置精简
- 边缘: Prometheus 改为 vmagent,统一 docker-compose.yml,内存+磁盘缓存
- 边缘脚本: 合并为 deploy.sh [--local],删除 run-edge-local、quick-setup、run-edge-with-cache
- 配置: 合并为 update-configs.sh,统一 targets.csv,生成 target-onvif/target-ping/target-topology
- 删除 topology-editor、旧格式 devices.csv/ping-targets.csv、setup-remote-write、test-connection
- 文档: 更新 EDGE_CACHE、TIANDITU(瓦片改 4090 直连 tile-cache)

Made-with: Cursor
2026-02-28 19:44:46 -05:00

73 lines
2.9 KiB
Markdown
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.
# 监控目标与 targets.csv
边缘监控目标统一由 `edge-agent/config/targets.csv` 配置,经 `update-configs.sh` 生成 `target-onvif.json``target-ping.json``target-topology.geojson`
---
## targets.csv 格式
表头(列顺序固定):
```text
type,ip,name,role,parent,uplink_type,network,device_type,model,location,username,password,onvif_port,lat,lon
```
| 字段 | 说明 | 适用类型 |
|------|------|----------|
| type | `ping` / `onvif` / `topology` | 必填 |
| ip | IPtopology 哑设备可空) | 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` 画点与连线。
---
## 示例
```csv
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
```
---
## 生成配置与拓扑
```bash
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** 数据源。
---
## 验证
- 边缘 Prometheushttp://localhost:9092`probe_success{job="network-ping"}``onvif_device_up`
- 中央 GrafanaVictoriaMetrics 数据源):`probe_success{region="workernode_1"}` 等。