Files
Distributed-Prometheus/README.md
Super User 72a5bf30b4 feat: 天地图瓦片缓存(tile-cache)、拓扑标注助手与文档更新
- tile-cache: 瓦片缓存服务(vec/cva)、启动探针、详细日志、上游超时可配置(UPSTREAM_TIMEOUT_MS)
- central: docker-compose 集成 tile-cache,env.example 增加 TILE_CACHE_* / TIANDITU_TK
- topology-editor: 天地图/缓存加载、GPS 安全来源错误提示、TIANDITU 文档(403/白名单、localhost 测试说明)
- doc: README 部署步骤与 GPS 安全来源说明,TIANDITU_CONFIG 完善

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 11:11:38 -05:00

102 lines
4.2 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.
# Distributed-Prometheus
分布式 Prometheus 监控系统,支持多用户、多设备监控。
---
## 部署顺序
**先中央,后边缘**(边缘向中央上报,中央必须先就绪)。
| 步骤 | 做什么 | 命令摘要 |
|------|--------|----------|
| **第一步** | 部署中央服务器 | `cd central-server && bash deploy.sh` |
| **第二步** | 部署边缘节点(可选,可多台) | 本机同机:`cd edge-agent && bash run-edge-local.sh`;远程:配 `.env``bash deploy.sh` |
| **第三步** | 多用户 / 告警(可选) | Grafana`central-server/grafana/setup-users.sh`;告警:编辑 `alertmanager/alertmanager.yml` |
**完整说明、验证方式与文档入口****[doc/README.md](doc/README.md)**(建议先看其中的「部署顺序」)。
---
## 项目结构
- **central-server/** — 中央Prometheus、Grafana、VictoriaMetrics、Alertmanager、拓扑标注助手
- **edge-agent/** — 边缘Prometheus Edge、ONVIF Exporter、Blackbox Exporter
- **topology-editor/** — 拓扑标注助手(与 central 同机运行):上传/下载 targets.csvH5 采集 GPS、天地图校验
---
## 快速开始(对应第一步 + 第二步)
1. **第一步:部署中央**
```bash
cd central-server
cp env.example .env # 可选
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`
边缘数据在 Grafana 中需选择数据源 **「VictoriaMetrics」** 才能看到中央自身指标在数据源「Prometheus」。
3. **第三步(可选)**:多用户见 `doc/USER_MANAGEMENT.md`,告警见 `doc/ALERTING.md`。
---
## 访问地址(默认)
- Grafana: http://localhost:3000
- Prometheus: http://localhost:9091
- VictoriaMetrics: http://localhost:8428
- Alertmanager: http://localhost:9093
- **拓扑标注助手**: http://localhost:4080
- 边缘 Prometheus端口 9092http://localhost:9092
---
## 多用户与数据隔离
Grafana 支持多组织、多用户;通过 Prometheus 标签做数据隔离(如 `user_group`)。管理员可查看全部数据。详见 **doc/USER_MANAGEMENT.md**。
---
## 拓扑标注助手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)**
其他文档均在 `doc/` 下架构ARCHITECTURE、中央/边缘配置、告警、部署指南、故障排查等,见 [doc/README.md#文档列表](doc/README.md)。