Install
openclaw skills install @kf-liu/qclaw-watchdogQClaw Watchdog - Monitors and auto-restarts QClaw when issues are detected. Works independently of QClaw, communicates via Feishu for alerts and commands. QClaw 看门狗 - 监控并自动重启 QClaw,独立于 QClaw 运行,通过飞书发送告警和接收指令。
openclaw skills install @kf-liu/qclaw-watchdog| 指令 Command | 说明 Description |
|---|---|
状态 / status | 检查 QClaw 状态 |
重启 / restart | 重启 QClaw |
启动 / start | 启动 QClaw |
退出 / quit | 退出 QClaw |
配置 / config | 显示当前配置 |
帮助 / help | 显示帮助 |
{
"feishu": {
"app_id": "your-app-id",
"app_secret": "your-secret",
"user_id": "your-open-id"
},
"qclaw": {
"health_url": "http://127.0.0.1:28789/health"
},
"watchdog": {
"check_interval_ms": 180000,
"restart_delay_ms": 10000,
"max_retries": 3
},
"logs": {
"main_log": "./watchdog.log",
"command_log": "./commands.log"
}
}
| 配置项 | 默认值 | 说明 |
|---|---|---|
check_interval_ms | 180000 | 巡检间隔(毫秒),默认3分钟 |
restart_delay_ms | 10000 | 重启延迟(毫秒),默认10秒 |
max_retries | 3 | 最大重试次数 |
也可以通过环境变量覆盖配置:
export FEISHU_APP_ID="your-app-id"
export FEISHU_APP_SECRET="your-secret"
export FEISHU_USER_ID="your-open-id"
export CHECK_INTERVAL_MS=300000
./init-config.sh
编辑 config.json,填入你的飞书应用配置。
# 前台运行
./start.sh
# 后台运行
nohup ./start.sh >> watchdog.log 2>&1 &
# 编辑 plist,修改路径
vim com.user.qclaw-watchdog.plist
# 复制到 LaunchAgents
cp com.user.qclaw-watchdog.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.user.qclaw-watchdog.plist
# 检查更新
./update.sh --check
# 从 GitHub 更新
./update.sh --github username/qclaw-watchdog
# 一键更新
./update.sh
# 强制更新
./update.sh --force
# 备份配置
cp config.json config.json.bak
# 拉取最新代码
git pull
# 恢复配置
cp config.json.bak config.json
# 重启服务
# 安装 GitHub CLI (如果未安装)
brew install gh
# 登录 GitHub
gh auth login
# 发布
./publish.sh --github yourname/qclaw-watchdog
发布后,其他用户可以通过以下方式安装:
# 克隆仓库
git clone https://github.com/yourname/qclaw-watchdog.git
# 配置
./init-config.sh
# 启动
./start.sh
qclaw-watchdog/
├── SKILL.md # 说明文档
├── watchdog.js # 主程序
├── config.json # 配置文件(可选)
├── start.sh # 启动脚本
├── update.sh # 更新脚本
└── init-config.sh # 配置初始化脚本
┌─────────────┐ WebSocket ┌─────────────┐
│ 飞书服务器 │ ←──────────────→ │ 看门狗 │
└─────────────┘ └──────┬───────┘
│
HTTP ↓
GET ┌─────────────┐
│ QClaw │
│ Gateway │
└─────────────┘
im:message:send_as_bot - 发送消息im:message:receive - 接收消息| 配置项 | 获取方式 |
|---|---|
| App ID | 应用详情 → 凭证与基础信息 |
| App Secret | 应用详情 → 凭证与基础信息 |
| User Open ID | 见下文 |
打开飞书 API 调试页面:
https://open.feishu.cn/api-explorer/cli_a9333bca0c78dceb?apiName=create&project=im&resource=message&version=v1
receive_id_type 选择 open_id