name: openclaw-health-guardian
description: Deploy OpenClaw health monitoring with auto-restart, cooldown (180s), and rate limiting (5/hour). Use when: (1) setting up OpenClaw health checks, (2) auto-restarting failed Gateway, (3) monitoring OpenClaw status, (4) deploying health daemon on macOS.
metadata:
{
"openclaw":
{
"emoji": "🛠️",
"requires": { "bins": ["node"] }
},
}
Auto-monitor and recover OpenClaw Gateway with intelligent rate limiting.
Install health guardian:
bash ~/.openclaw/skills/openclaw-health-guardian/scripts/install.sh
Verify installation:
launchctl list | grep openclaw
| Feature | Value | Description |
|---|---|---|
| --------- | ------- | ------------- |
| Check Interval | 5 minutes | LaunchAgent StartInterval |
| Cooldown | 180 seconds | Minimum between restarts |
| Rate Limit | 5/hour | Max restarts per hour |
| HTTP Timeout | 5 seconds | curl --max-time |
| Auto Notify | Terminal popup | AppleScript alert on failure |
```bash
bash ~/.openclaw/skills/openclaw-health-guardian/scripts/install.sh
```
```bash
launchctl list | grep com.openclaw.healthcheck
```
```bash
tail -f ~/.openclaw/logs/health-check.log
```
```bash
bash ~/.openclaw/scripts/openclaw-health-check.sh
```
| Command | Purpose | |
|---|---|---|
| --------- | --------- | |
| `launchctl list \ | grep openclaw` | Check service status |
tail -f ~/.openclaw/logs/health-check.log | View real-time logs | |
bash ~/.openclaw/scripts/openclaw-health-check.sh | Manual check | |
launchctl unload ~/Library/LaunchAgents/com.openclaw.healthcheck.plist | Stop service | |
launchctl load ~/Library/LaunchAgents/com.openclaw.healthcheck.plist | Start service |
After installation:
~/.openclaw/
├── scripts/
│ └── openclaw-health-check.sh # Main script
├── state/
│ ├── last_restart # Timestamp
│ ├── restart_count # Hourly counter
│ └── hour_marker # Hour tracking
└── logs/
├── health-check.log # Main log
├── health-check-daemon.log # Daemon stdout
└── health-check-daemon-error.log # Daemon stderr
~/Library/LaunchAgents/
└── com.openclaw.healthcheck.plist # LaunchAgent config
Normal:
[2026-03-16 10:28:47] No issues found. OpenClaw is healthy!
Cooldown triggered:
[2026-03-16 10:30:05] 冷却期内 (120s/180s),跳过重启操作
Rate limit triggered:
[2026-03-16 10:30:05] 本小时已达重启上限(5次),跳过
Restart executed:
[2026-03-16 10:30:02] 已记录重启事件 (冷却: 180s, 限流: 5/小时)
[2026-03-16 10:30:05] Gateway restart completed successfully
# Stop and remove service
launchctl unload ~/Library/LaunchAgents/com.openclaw.healthcheck.plist
rm ~/Library/LaunchAgents/com.openclaw.healthcheck.plist
# Remove scripts and logs
rm ~/.openclaw/scripts/openclaw-health-check.sh
rm -rf ~/.openclaw/state/
rm ~/.openclaw/logs/health-check*.log
references/technical-details.md - Implementation detailsreferences/troubleshooting.md - Common issues共 2 个版本