← 返回 Skills 市场
zhangss110

OpenClaw Gateway Guardian

作者 zhangss110 · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ⚠ suspicious
141
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install gateway-guardian-zx
功能描述
OpenClaw 看门狗 - 自动监控 Gateway 状态,宕机时自动重启,支持配置守护和模型故障转移
使用说明 (SKILL.md)

\x3Cp align="center"> \x3Cimg src="https://img.shields.io/badge/Python-3.8%2B-blue?style=for-the-badge&logo=python" alt="Python"> \x3Cimg src="https://img.shields.io/badge/OpenClaw-2026.3%2B-green?style=for-the-badge" alt="OpenClaw"> \x3Cimg src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License"> \x3C/p>

\x3Ch1 align="center">🛡️ OpenClaw Gateway Guardian / OpenClaw 看门狗\x3C/h1>

\x3Cp align="center"> \x3Cstrong>自动监控 OpenClaw Gateway 状态,宕机时自动重启,支持配置守护和模型故障转移\x3C/strong>\x3Cbr> \x3Cem>Automatically monitor OpenClaw Gateway status, auto-restart on crash, with config guardian and model failover support.\x3C/em> \x3C/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\\
pm\\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\
pm\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 启用模型故障转移

飞书 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


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

安全使用建议
This skill appears to do what it claims: monitor a local OpenClaw gateway, restart it, back up and restore local config, and optionally notify via Feishu. Before installing: 1) Review scripts/install.bat to see how the scheduled task is created (install will add an on-logon Task Scheduler entry). 2) Understand that the watchdog will attempt to kill processes using the gateway port (taskkill/netstat) — this can terminate unrelated processes if they bind the same port and may require elevated rights. 3) If you enable Feishu notifications, the script will post log snippets and alerts to the webhook you configure — only use a webhook you trust. 4) The backup files are stored locally and base64-encoded; set a proper backup encryptKey in config.json if you need encrypted backups (the default is a placeholder). 5) The script modifies your local OpenClaw config when performing failover/restore actions — review and test in a safe environment before deploying to production. Everything else (no hidden remote endpoints, no unexpected credential requests) looks consistent with the stated purpose.
功能分析
Type: OpenClaw Skill Name: gateway-guardian-zx Version: 1.1.1 The skill bundle implements a watchdog service with high-risk capabilities including process termination (taskkill), system persistence via Windows Task Scheduler (schtasks), and network communication via Feishu webhooks. While these actions are aligned with the stated purpose of monitoring the OpenClaw Gateway, the script (watchdog_simple.py) possesses the ability to read sensitive configuration files, capture log snippets, and execute shell commands, which represents a significant attack surface. The use of shell=True in subprocess calls and the lack of input sanitization for system paths are notable vulnerabilities.
能力评估
Purpose & Capability
Name/description match what the files implement: the script monitors a local OpenClaw gateway port, attempts restarts, backs up/restores local OpenClaw config, optionally switches models, and sends Feishu notifications. Declared required binaries (python, openclaw) are appropriate and used by the code. There are no unrelated external service credentials requested.
Instruction Scope
SKILL.md instructions (copy files, run the Python script or run install.bat) align with the code. The runtime actions are local: checking TCP port, reading/writing files under the user's profile, launching/killing processes, and POSTing to a user-provided Feishu webhook. The script does read local OpenClaw logs and config (expected) and will kill processes on the gateway port (intended for restarting). It does not contain instructions to contact unknown external endpoints beyond the configured Feishu webhook.
Install Mechanism
No install spec is provided (instruction-only + included script). Installation is manual/copy-or-run via install.bat; nothing is downloaded from arbitrary URLs and no archives are extracted by the skill itself. This is a low-risk install pattern for this type of utility.
Credentials
The skill does not require environment secrets or external credentials in the registry metadata. The included config.json has placeholders for a Feishu webhook URL and an encryptKey for backups (both optional). Asking users to provide a webhook for notifications is proportionate; the script will send log snippets to that webhook if configured — this is expected behavior and should be configured only with a trusted webhook.
Persistence & Privilege
The skill can set up auto-start (the README/install will create a Windows scheduled task) and runs commands that kill/restart processes (netstat/taskkill). These are consistent with a watchdog but may require elevated permissions or affect other processes bound to the same port. The skill is not marked always:true and does not force inclusion in every agent run.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gateway-guardian-zx
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gateway-guardian-zx 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.1
修复安装路径
v1.1.0
**OpenClaw Gateway Guardian v1.1.0 introduces config guardian and model failover support.** - Added config guardian: monitors config file changes and automatically backs up. - Added model failover: automatically switches to a backup model if the primary model fails. - Improved logging format and added more tags (devops, monitoring, infrastructure). - Updated documentation structure for clarity and completeness. - Fixed various bugs.
v1.0.0
Initial release of gateway-guardian-zx. - Automatically monitors OpenClaw Gateway status and restarts on crash (checks every 15 seconds, up to 3 retries). - Supports manual control (stop/restart) by creating/deleting a flag file. - Optional notifications via Feishu or WeChat. - Auto-start on Windows boot via Task Scheduler. - Provides configurable logging and backup options.
元数据
Slug gateway-guardian-zx
版本 1.1.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

OpenClaw Gateway Guardian 是什么?

OpenClaw 看门狗 - 自动监控 Gateway 状态,宕机时自动重启,支持配置守护和模型故障转移. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 141 次。

如何安装 OpenClaw Gateway Guardian?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gateway-guardian-zx」即可一键安装,无需额外配置。

OpenClaw Gateway Guardian 是免费的吗?

是的,OpenClaw Gateway Guardian 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

OpenClaw Gateway Guardian 支持哪些平台?

OpenClaw Gateway Guardian 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 OpenClaw Gateway Guardian?

由 zhangss110(@zhangss110)开发并维护,当前版本 v1.1.1。

💬 留言讨论