v1.0.0 remote-host-agent: 机器B监控/控制轻量方案(HTTP上报+命令长轮询)

- collector.py: 机器A端 FastAPI 服务(16018),token认证 + strict/open 命令白名单 + SQLite存储
- agent.sh: 机器B端轻量agent(仅bash+curl+base64,零安装),采集CPU/内存/磁盘/负载/开机时间 + 长轮询执行命令回传结果
- hostctl.py: 机器A端 CLI(status/hosts/run/history/commands)
- host-agent.service: 机器B端 systemd 服务
- start.sh: collector 启停脚本
This commit is contained in:
2026-08-19 19:08:23 +08:00
commit c877b25ff6
8 changed files with 928 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# ============================================================
# remote-host-agent 机器B端配置
# 复制为 config.sh 并填写后,与 agent.sh 放在同一目录
# ============================================================
# 机器A 的 collector 服务地址(A 有固定 IP/域名)
SERVER="http://121.40.164.32:16018"
# 认证 token(在机器A 执行: cat data/token.txt 获取)
TOKEN=""
# 本机标识(默认取 hostname,建议设为有意义的名称如 web-server-01
HOST_NAME="$(hostname)"
# 上报间隔(秒)
INTERVAL=10
# 命令执行超时(秒)
CMD_TIMEOUT=30