OpenClaw Gateway Guardian

OpenClaw 看门狗 - 自动监控 Gateway 状态,宕机时自动重启,支持配置守护和模型故障转移

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "OpenClaw Gateway Guardian" with this command: npx skills add zhangss110/gateway-guardian-zx

<p align="center"> <img src="https://img.shields.io/badge/Python-3.8%2B-blue?style=for-the-badge&logo=python" alt="Python"> <img src="https://img.shields.io/badge/OpenClaw-2026.3%2B-green?style=for-the-badge" alt="OpenClaw"> <img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License"> </p> <h1 align="center">🛡️ OpenClaw Gateway Guardian / OpenClaw 看门狗</h1> <p align="center"> <strong>自动监控 OpenClaw Gateway 状态,宕机时自动重启,支持配置守护和模型故障转移</strong><br> <em>Automatically monitor OpenClaw Gateway status, auto-restart on crash, with config guardian and model failover support.</em> </p>

✨ 功能特点 / Features

功能说明
🏥 Gateway 监控自动检测 Gateway 状态(每 15 秒)
🔄 自动重启宕机 30 秒后自动重启(最多 3 次重试)
🛡️ 配置守护监控配置文件变更,自动备份
🔀 模型故障转移主模型失败时自动切换备用模型
📱 飞书通知宕机/恢复/配置变更实时通知
🚀 开机自启动通过 Windows 计划任务自动运行
💾 配置备份自动备份配置文件,支持一键恢复

📦 安装 / Installation

方式一:安装脚本(推荐)

# 直接运行安装脚本
.\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

⚙️ 配置 / Configuration

完整配置项

{
  "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.exePathstring%USERPROFILE%\AppData\Roaming\npm\openclaw.cmdOpenClaw 程序路径
openclaw.gatewayPortnumber18789Gateway 端口
watchdog.checkIntervalMsnumber15000检查间隔(毫秒)
watchdog.maxDowntimeMsnumber30000最大宕机时间(毫秒)
watchdog.maxRetriesnumber3最大重试次数
configGuardian.enabledbooleantrue启用配置守护
modelFailover.enabledbooleanfalse启用模型故障转移

飞书 Webhook 配置

  1. 打开 https://open.feishu.cn/document/ukTMukTMukTM/uADOwUjLwgDM14CM4ATN
  2. 创建自定义机器人
  3. 复制 Webhook URL 到配置文件中

📖 使用方法 / Usage

自动模式(默认)

看门狗会自动监控 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

📁 文件结构 / File Structure

openclaw-watchdog/
├── SKILL.md                    # 技能说明文档
└── scripts/
    ├── watchdog_simple.py      # 主程序
    ├── config.json             # 配置文件
    └── install.bat             # 安装脚本

📊 日志 / Logs

  • 主日志: %USERPROFILE%\.openclaw\watchdog\logs\guardian_YYYYMMDD.log
  • 配置备份: %USERPROFILE%\.openclaw\watchdog\backup\

🔧 开机自启动 / Auto-start on Boot

安装时自动创建 Windows 计划任务:

schtasks /create /tn "OpenClaw Gateway Guardian" /tr "python %USERPROFILE%\.openclaw\watchdog\watchdog_simple.py" /sc onlogon /rl limited

🗑️ 卸载 / Uninstall

# 删除计划任务
schtasks /delete /tn "OpenClaw Gateway Guardian" /f

# 删除文件(可选)
rmdir /s %USERPROFILE%\.openclaw\watchdog

📝 更新日志 / Changelog

v1.1.0 (2026-03-26)

  • ✨ 新增配置守护功能(监控配置文件变更)
  • ✨ 新增模型故障转移支持
  • ✨ 优化日志输出格式
  • ✨ 增加更多标签(devops, monitoring, infrastructure)
  • 🐛 修复多项 Bug

v1.0.0 (2026-03-20)

  • 🎉 初始版本
  • ✅ 基本的 Gateway 监控和自动重启
  • ✅ 飞书通知支持
  • ✅ 配置文件备份/恢复

📋 依赖 / Dependencies

  • Python 3.8+
  • OpenClaw 2026.3.22+

🤝 贡献 / Contributing

欢迎提交 Issue 和 Pull Request!


📄 许可证 / License

MIT License


<p align="center">🦐 感谢使用!有问题随时提问。</p> <p align="center">Thanks for using! Feel free to ask questions.</p>

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Version Drift Publish

One command to check if your entire stack is up to date. SSHes into servers, queries APIs, and compares installed versions against latest — across every serv...

Registry SourceRecently Updated
2490Profile unavailable
Coding

Clawhub Skill Infra Watchdog

Self-hosted infrastructure monitoring for HTTP, TCP, SSL, disk, memory, load, Docker, DNS, and custom commands with alerting via OpenClaw messaging.

Registry SourceRecently Updated
8540Profile unavailable
Coding

Service Watchdog

Monitors self-hosted services by checking HTTP endpoints, TCP ports, SSL expiry, and DNS resolution, then reports status and alerts in concise, chat-friendly...

Registry SourceRecently Updated
6812Profile unavailable
Security

Security Dashboard

Real-time security monitoring dashboard for OpenClaw and Linux server infrastructure. Monitors gateway status, network security, public exposure, system updates, SSH access, TLS certificates, and resource usage.

Registry Source
1.6K2Profile unavailable