Install
openclaw skills install @zhangss110/gateway-guardian-zxOpenClaw 看门狗 - 自动监控 Gateway 状态,宕机时自动重启,支持配置守护和模型故障转移
openclaw skills install @zhangss110/gateway-guardian-zx
自动监控 OpenClaw Gateway 状态,宕机时自动重启,支持配置守护和模型故障转移
Automatically monitor OpenClaw Gateway status, auto-restart on crash, with config guardian and model failover support.
| 功能 | 说明 |
|---|---|
| 🏥 Gateway 监控 | 自动检测 Gateway 状态(每 15 秒) |
| 🔄 自动重启 | 宕机 30 秒后自动重启(最多 3 次重试) |
| 🛡️ 配置守护 | 监控配置文件变更,自动备份 |
| 🔀 模型故障转移 | 主模型失败时自动切换备用模型 |
| 📱 飞书通知 | 宕机/恢复/配置变更实时通知 |
| 🚀 开机自启动 | 通过 Windows 计划任务自动运行 |
| 💾 配置备份 | 自动备份配置文件,支持一键恢复 |
# 直接运行安装脚本
.\scripts\install.bat
# 1. 创建看门狗目录
mkdir %USERPROFILE%\.openclaw\watchdog
# 2. 复制文件
copy scripts\* %USERPROFILE%\.openclaw\watchdog\
# 3. 配置(可选)
# 编辑 config.json 设置飞书 Webhook 等
# 4. 启动
python %USERPROFILE%\.openclaw\watchdog\watchdog_simple.py
{
"openclaw": {
"exePath": "%USERPROFILE%\\AppData\\Roaming\\npm\\openclaw.cmd",
"dataDir": "%USERPROFILE%\\.openclaw",
"gatewayPort": 18789
},
"watchdog": {
"checkIntervalMs": 15000,
"maxDowntimeMs": 30000,
"maxRetries": 3,
"stopFlagPath": "%USERPROFILE%\\.openclaw\\stop.flag",
"logDir": "%USERPROFILE%\\.openclaw\\watchdog\\logs"
},
"configGuardian": {
"enabled": true,
"checkIntervalSec": 60,
"alertOnChange": true
},
"modelFailover": {
"enabled": false,
"primaryModel": "baiduqianfancodingplan/qianfan-code-latest",
"fallbackModel": "custom-qianfan-baidubce-com/deepseek-v3.2"
},
"feishu": {
"webhookUrl": "YOUR_FEISHU_WEBHOOK_URL"
}
}
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
openclaw.exePath | string | %USERPROFILE%\AppData\Roaming\npm\openclaw.cmd | OpenClaw 程序路径 |
openclaw.gatewayPort | number | 18789 | Gateway 端口 |
watchdog.checkIntervalMs | number | 15000 | 检查间隔(毫秒) |
watchdog.maxDowntimeMs | number | 30000 | 最大宕机时间(毫秒) |
watchdog.maxRetries | number | 3 | 最大重试次数 |
configGuardian.enabled | boolean | true | 启用配置守护 |
modelFailover.enabled | boolean | false | 启用模型故障转移 |
看门狗会自动监控 Gateway,宕机后自动重启。
# 启动看门狗
python watchdog_simple.py
# 查看状态
python watchdog_simple.py status
# 输出: Gateway Port 18789: UP
# 手动备份
python watchdog_simple.py backup
# 手动恢复
python watchdog_simple.py restore
| 操作 | 命令 |
|---|---|
| 停止自动重启 | type nul > %USERPROFILE%\.openclaw\stop.flag |
| 恢复自动重启 | del %USERPROFILE%\.openclaw\stop.flag |
openclaw-watchdog/
├── SKILL.md # 技能说明文档
└── scripts/
├── watchdog_simple.py # 主程序
├── config.json # 配置文件
└── install.bat # 安装脚本
%USERPROFILE%\.openclaw\watchdog\logs\guardian_YYYYMMDD.log%USERPROFILE%\.openclaw\watchdog\backup\安装时自动创建 Windows 计划任务:
schtasks /create /tn "OpenClaw Gateway Guardian" /tr "python %USERPROFILE%\.openclaw\watchdog\watchdog_simple.py" /sc onlogon /rl limited
# 删除计划任务
schtasks /delete /tn "OpenClaw Gateway Guardian" /f
# 删除文件(可选)
rmdir /s %USERPROFILE%\.openclaw\watchdog
欢迎提交 Issue 和 Pull Request!
MIT License
🦐 感谢使用!有问题随时提问。
Thanks for using! Feel free to ask questions.