hy-app-monitor/README.md
2026-04-22 00:37:52 +08:00

94 lines
1.7 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.

# hy-app-monitor
一个给 `deploy` 机器使用的轻量监控页。
- 前端:静态 HTML + Vue 3 CDN
- 后端Python 3 标准库 HTTP 服务
- 默认端口:`2026`
- 默认监听:`0.0.0.0`
## 功能
-`deploy` 机器内部探测内网 Java / Golang 服务健康状态
- 对外提供监控页和 JSON API
- 提供启动 / 停止 / 重启 / 状态脚本
- 提供通过 TAT 放开 2026 端口和远端拉取部署的脚本
## 目录
- `server.py`:后端入口
- `config/targets.json`:监控目标配置
- `static/`:前端页面
- `scripts/`:启停脚本
- `ops/`TAT 相关脚本
## 本地启动
```bash
cd /opt/hy-app-monitor
bash scripts/start.sh
```
默认访问:
```bash
http://127.0.0.1:2026/
```
## 脚本
```bash
bash scripts/start.sh
bash scripts/stop.sh
bash scripts/restart.sh
bash scripts/status.sh
```
## 环境变量
- `APP_BIND`:默认 `0.0.0.0`
- `APP_PORT`:默认 `2026`
- `TARGETS_FILE`:默认 `config/targets.json`
- `PROBE_TIMEOUT_SECONDS`:默认 `3`
- `PROBE_CACHE_TTL_SECONDS`:默认 `5`
- `PROBE_MAX_WORKERS`:默认 `12`
## 用 TAT 放开 2026
先确保本机有腾讯云密钥环境变量:
```bash
export TENCENT_SECRET_ID=...
export TENCENT_SECRET_KEY=...
```
执行:
```bash
python3 ops/open_port_via_tat.py
```
默认会针对 deploy 机器 `ins-ntmpcd3a``me-saudi-arabia` 区域:
- 通过 TAT 在机器内尝试放开系统防火墙
- 通过 TAT 调腾讯云 API 放开安全组 TCP `2026`
## 用 TAT 拉取并启动
```bash
python3 ops/deploy_via_tat.py
```
默认远端目录:
```bash
/opt/hy-app-monitor
```
默认会:
1. clone / pull 仓库
2. 给脚本加执行权限
3. 重启服务
4. 检查 2026 端口监听