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
This commit is contained in:
User
2026-02-28 19:44:46 -05:00
parent 72a5bf30b4
commit 650e5145f1
35 changed files with 319 additions and 2774 deletions

View File

@@ -11,7 +11,7 @@
| 步骤 | 做什么 | 命令摘要 |
|------|--------|----------|
| **第一步** | 部署中央服务器 | `cd central-server && bash deploy.sh` |
| **第二步** | 部署边缘节点(可选,可多台) | 本机同机:`cd edge-agent && bash run-edge-local.sh`;远程:配 `.env``bash deploy.sh` |
| **第二步** | 部署边缘节点(可选,可多台) | 本机同机:`cd edge-agent && bash deploy.sh --local`;远程:配 `.env``bash deploy.sh` |
| **第三步** | 多用户 / 告警(可选) | Grafana`central-server/grafana/setup-users.sh`;告警:编辑 `alertmanager/alertmanager.yml` |
**完整说明、验证方式与文档入口****[doc/README.md](doc/README.md)**(建议先看其中的「部署顺序」)。
@@ -20,9 +20,8 @@
## 项目结构
- **central-server/** — 中央Prometheus、Grafana、VictoriaMetrics、Alertmanager、拓扑标注助手
- **edge-agent/** — 边缘:Prometheus Edge、ONVIF Exporter、Blackbox Exporter
- **topology-editor/** — 拓扑标注助手(与 central 同机运行):上传/下载 targets.csvH5 采集 GPS、天地图校验
- **central-server/** — 中央Prometheus、Grafana、VictoriaMetrics、Alertmanager
- **edge-agent/** — 边缘:vmagent、ONVIF Exporter、Blackbox Exporter
---
@@ -35,11 +34,9 @@
bash deploy.sh
```
访问 Grafanahttp://localhost:3000admin / admin123
拓扑标注助手随中央一起启动http://localhost:4080 — 上传本机 `targets.csv`,选设备、补 GPS 或地图点击修正后下载 CSV部署边缘 `edge-agent/config/`。
2. **第二步:部署边缘**(可选)
- 本机同机:`cd edge-agent && bash run-edge-local.sh`
- 边缘在别台机器:在 `edge-agent` 里配 `.env` 的 `CENTRAL_SERVER_HOST`、`CENTRAL_SERVER_PORT=8428`,然后 `cd config && ./update-configs.sh && cd .. && bash deploy.sh`
2. **第二步:部署边缘**(可选)
- 本机同机:`cd edge-agent && bash deploy.sh --local`
- 边缘在别台机器:在 `edge-agent` 里配 `.env` 后 `bash deploy.sh`
边缘数据在 Grafana 中需选择数据源 **「VictoriaMetrics」** 才能看到中央自身指标在数据源「Prometheus」。
@@ -53,7 +50,6 @@
- Prometheus: http://localhost:9091
- VictoriaMetrics: http://localhost:8428
- Alertmanager: http://localhost:9093
- **拓扑标注助手**: http://localhost:4080
- 边缘 Prometheus端口 9092http://localhost:9092
---
@@ -64,36 +60,6 @@ Grafana 支持多组织、多用户;通过 Prometheus 标签做数据隔离(
---
## 拓扑标注助手targets.csv 标注流程)
拓扑标注助手主要解决「在现场用手机给设备打坐标、维护拓扑关系」的问题,典型使用流程:
1. **准备 CSV**
在本机编辑好 `targets.csv`(推荐按 `edge-agent/config/targets.csv` 的示例维护完整的 type/name/role/parent/uplink_type 等字段)。
2. **上传到标注助手**
中央已启动后,浏览器访问 `http://localhost:4080`
- 在顶部「上传 / 下载 targets.csv」区域选择本机 `targets.csv` 并点击 **上传 CSV**。
3. **现场标注 / 校正坐标**
- 在「选择已有设备」下拉中选中要标注的设备;
- 在现场用手机点击 **获取当前 GPS 坐标**,或在天地图上点击正确位置;
- 如有需要,补充/调整 `parent`、`uplink_type` 等字段;
- 点击 **保存到 targets.csv**(仅修改标注助手中的当前副本)。
4. **下载并应用到边缘**
- 在页面顶部点击 **下载 targets.csv**,得到新的 CSV
- 将其拷贝到边缘节点的 `edge-agent/config/targets.csv` 覆盖原文件;
- 在边缘节点执行:
```bash
cd edge-agent/config
./update-configs.sh
./csv-to-topology-geojson.sh targets.csv topology.geojson
```
以生成最新的 onvif/ping 配置与拓扑 GeoJSONGrafana Geomap 即可按经纬度和拓扑关系展示设备与链路。
---
## 文档
**入口与部署顺序****[doc/README.md](doc/README.md)**