完善中央与边缘部署、远程写入与监控文档

- 增加中央与边缘完整配置和部署脚本
- 引入 VictoriaMetrics 数据源与 remote_write 故障排查说明
- 新增 edge-agent 配置脚本、ONVIF 自建 exporter 与 ping 监控示例

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Super User
2026-02-25 04:24:40 -05:00
parent 9e37f79a36
commit 95a09fd9d8
52 changed files with 5978 additions and 0 deletions

View File

@@ -1,2 +1,68 @@
# 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
---
## 快速开始(对应第一步 + 第二步)
1. **第一步:部署中央**
```bash
cd central-server
cp env.example .env # 可选
bash deploy.sh
```
访问 Grafanahttp://localhost:3000admin / admin123
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/ALERTMANAGER_CONFIG.md`。
---
## 访问地址(默认)
- Grafana: http://localhost:3000
- Prometheus: http://localhost:9091
- VictoriaMetrics: http://localhost:8428
- Alertmanager: http://localhost:9093
边缘 Prometheus端口 9092http://localhost:9092
---
## 多用户与数据隔离
Grafana 支持多组织、多用户;通过 Prometheus 标签做数据隔离(如 `user_group`)。管理员可查看全部数据。详见 **doc/USER_MANAGEMENT.md**。
---
## 文档
**入口与部署顺序****[doc/README.md](doc/README.md)**
其他文档均在 `doc/` 下架构ARCHITECTURE、中央/边缘配置、告警、部署指南、故障排查等,见 [doc/README.md#文档列表](doc/README.md)。