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:
@@ -0,0 +1,28 @@
|
||||
# ============================================================
|
||||
# remote-host-agent 机器B端 systemd 服务
|
||||
# 部署步骤(B 端 root):
|
||||
# mkdir -p /opt/host-agent
|
||||
# 将 agent.sh / config.sh 放入 /opt/host-agent/
|
||||
# cp host-agent.service /etc/systemd/system/
|
||||
# systemctl daemon-reload
|
||||
# systemctl enable --now host-agent
|
||||
# 常用:
|
||||
# systemctl status host-agent
|
||||
# journalctl -u host-agent -f
|
||||
# ============================================================
|
||||
[Unit]
|
||||
Description=Remote Host Agent (machine B -> machine A)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/host-agent
|
||||
ExecStart=/bin/bash /opt/host-agent/agent.sh
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=append:/var/log/host-agent.log
|
||||
StandardError=append:/var/log/host-agent.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user