feat: 引入 vmauth 鉴权与严格多租户

- 对外端口统一为 18428(vmauth 入口),VM 不再直接暴露宿主机端口
- 边缘 vmagent 与中央 Prometheus remote_write 增加 basic auth
- 支持 tenants.csv 驱动的 per-tenant 写入/查询隔离,并提供管理员跨租户只读查询
- 更新 Grafana provisioning 与部署/文档

Made-with: Cursor
This commit is contained in:
root
2026-04-22 11:41:13 +00:00
parent ab1515dffb
commit c4825c2d27
21 changed files with 278 additions and 37 deletions

View File

@@ -6,7 +6,7 @@
## 第一步:部署中央服务器
**前置**Docker、Docker Compose端口 3000、9091、8428、9093 未被占用;磁盘充足。
**前置**Docker、Docker Compose端口 3000、9091、18428、9093 未被占用;磁盘充足。
```bash
cd central-server
@@ -14,7 +14,7 @@ cp env.example .env # 可选按需改端口、Traefik 等
bash deploy.sh
```
**验证**Grafana http://localhost:3000admin/admin123、Prometheus http://localhost:9091、VictoriaMetrics http://localhost:8428。
**验证**Grafana http://localhost:3000admin/admin123、Prometheus http://localhost:9091、vmauthVictoriaMetrics 入口)http://localhost:18428。
**详细**[CENTRAL_SERVER_CONFIG](CENTRAL_SERVER_CONFIG.md)、[central-server/CONFIGURATION.md](../central-server/CONFIGURATION.md)。
@@ -22,9 +22,9 @@ bash deploy.sh
## 第二步:部署边缘节点
**前提**中央已运行VictoriaMetrics 8428 可访问。
**前提**:中央已运行,vmauthVictoriaMetrics 入口18428 可访问。
- **本机同机**`cd edge-agent && bash deploy.sh --local`(中央地址设为 host.docker.internal:8428
- **本机同机**`cd edge-agent && bash deploy.sh --local`(中央地址设为 host.docker.internal:18428
- **边缘跨机**`cd edge-agent` → 编辑 `.env``CENTRAL_SERVER_HOST=中央IP``bash deploy.sh`
**验证**:边缘 http://localhost:9092中央 Grafana 选数据源 **VictoriaMetrics**,查询 `probe_success{job="network-ping"}` 可见边缘数据。
@@ -32,7 +32,7 @@ bash deploy.sh
**targets.csv**:部署时自动生成 target-*.json修改 targets.csv 后需手动 `cd config && ./update-configs.sh`vmagent 每 5 分钟自动重载。
**常见问题**
- 看不到边缘数据:确认 `.env` 中为中央 IP跨机不能用 host.docker.internal`curl -s -o /dev/null -w "%{http_code}" http://<中央IP>:8428/health` 应为 200。
- 看不到边缘数据:确认 `.env` 中为中央 IP跨机不能用 host.docker.internal`curl -s -o /dev/null -w "%{http_code}" http://<中央IP>:18428/health` 应为 200(需要带鉴权时用 `-u user:pass`
- 端口冲突:边缘已映射 9092与中央 9091 区分。
**详细**[EDGE_AGENT_CONFIG](EDGE_AGENT_CONFIG.md)、[TARGETS_AND_MONITORING](TARGETS_AND_MONITORING.md)。