技术栈
组件 |
技术 |
说明 |
|---|
ops-bot TG |
python-telegram-bot v20+ |
async,ops 命令 |
ops-bot QQ |
直接 websockets(OneBot V11) |
无框架,120 行 |
AI 分析平台 |
OpenClaw 2026.x |
systemd,Telegram + QQ 频道 |
HTTP Agent |
FastAPI + uvicorn |
部署在每台目标 VPS |
系统信息 |
psutil |
CPU/内存/磁盘 |
Docker 操作 |
docker SDK for Python |
容器管理 |
配置管理 |
PyYAML + python-dotenv |
yaml + .env |
告警轮询 |
asyncio 定时任务 |
Phase 3 |
项目目录结构
ops-bot/
├── CLAUDE.md
├── README.md
├── .env.example
├── .env # 不提交 git
├── requirements.txt
├── docker-compose.yml
├── Makefile
│
├── config/
│ ├── config.yaml # 主配置
│ └── alerts.yaml # 告警阈值
│
├── bot/ # ops-bot 主服务(树莓派 Docker)
│ ├── main.py
│ ├── router.py
│ ├── permissions.py
│ ├── platforms/
│ │ ├── base.py # 抽象接口 MessagePlatform
│ │ ├── telegram_bot.py
│ │ └── qq_bot.py # 直接 websockets,OneBot V11
│ ├── handlers/
│ │ ├── status.py
│ │ ├── docker_handler.py
│ │ ├── log_handler.py
│ │ ├── restart_handler.py
│ │ └── services_handler.py
│ ├── client/
│ │ └── agent_client.py
│ ├── monitoring/ # Phase 3 告警
│ │ └── monitor.py
│ └── ai/
│ └── analyzer.py # AI 功能已迁移至 OpenClaw,此文件保留存根
│
├── agent/ # 轻量 Agent(部署在每台目标 VPS)
│ ├── main.py
│ ├── handlers.py
│ ├── requirements.txt
│ ├── Dockerfile
│ └── deploy/
│ ├── install.sh
│ ├── ops-agent.service
│ └── README.md
│
└── openclaw/ # OpenClaw 自定义 Skill(不含 OpenClaw 本体)
└── skills/
└── ops-agent/
└── SKILL.md # 封装 VPS Agent HTTP API