system-healthcheck
Three-tier system health monitoring for OpenClaw
English | 简体中文
Features
- - L1 Fast Check (<200ms): Definition file existence check
- L2 Hourly Check (<5s): System resources, services, logs
- L3 Daily Audit (<60s): Comprehensive system audit
- Heartbeat Mechanism: Quiet when healthy, alert on issues
- i18n Support: Auto-detect language (en/zh-CN)
- Zero External Dependencies: Works out of the box
Installation
CODEBLOCK0
Or manually:
CODEBLOCK1
Quick Start
1. L1 Fast Check (Manual)
CODEBLOCK2
2. L2 Hourly Check (Manual)
CODEBLOCK3
3. Setup Crontab
CODEBLOCK4
4. Heartbeat Check
CODEBLOCK5
Configuration
Edit config/default_config.yaml:
CODEBLOCK6
Output Examples
L2 Hourly Check
CODEBLOCK7
Heartbeat (All OK)
CODEBLOCK8
Heartbeat (Issues Detected)
CODEBLOCK9
Scripts
| Script | Purpose | Frequency |
|---|
| INLINECODE1 | Definition files check | Before conversations |
| INLINECODE2 |
System health check | Hourly (cron) |
|
l3_daily_audit.py | Comprehensive audit | Daily 08:00 (cron) |
|
heartbeat.py | Work-hours heartbeat | Every 30min (cron) |
CLI Options
CODEBLOCK10
Exit Codes
- -
0: All checks passed - INLINECODE6 : One or more checks failed
Internationalization
Supported languages:
- -
en - English - INLINECODE8 - 简体中文
Auto-detected from system locale. Override with:
CODEBLOCK11
Requirements
- - Python 3.8+
- Linux or macOS
- No external dependencies (optional:
rich for colorful output, pyyaml for config)
License
MIT
Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
Changelog
v1.0.0 (2026-03-23)
- - Initial release
- L1/L2/L3 checks
- Heartbeat mechanism
- i18n support (en/zh-CN)
system-healthcheck
OpenClaw 三层系统健康监控
English | 简体中文
功能特性
- - L1 快速检查(<200毫秒):定义文件存在性检查
- L2 每小时检查(<5秒):系统资源、服务、日志
- L3 每日审计(<60秒):全面系统审计
- 心跳机制:健康时静默,异常时告警
- 国际化支持:自动检测语言(英文/简体中文)
- 零外部依赖:开箱即用
安装
bash
clawhub install system-healthcheck
或手动安装:
bash
git clone https://github.com/your-username/system-healthcheck.git ~/.openclaw/skills/system-healthcheck
快速开始
1. L1 快速检查(手动)
bash
cd ~/.openclaw/skills/system-healthcheck
python scripts/l1fastcheck.py
2. L2 每小时检查(手动)
bash
python scripts/l2hourlycheck.py
3. 设置定时任务
bash
cat templates/crontab_example.txt
复制并编辑定时任务
crontab -e
4. 心跳检查
bash
python scripts/heartbeat.py
配置
编辑 config/default_config.yaml:
yaml
国际化
i18n:
auto_detect: true # 自动检测系统语言
# locale: zh-CN # 或手动指定
阈值
thresholds:
disk_warning: 80 # 磁盘警告(%)
disk_critical: 95 # 磁盘严重警告(%)
memory
warningmb: 500 # 内存警告(MB)
log
sizemb: 100 # 日志大小警告(MB)
心跳
heartbeat:
enabled: true
work
hoursstart: 9
work
hoursend: 18
quiet
onok: true # 全部正常时静默
输出示例
L2 每小时检查
🦞 系统健康检查 · 2026-03-23 09:00:00
✅ 磁盘使用率:45%(阈值:80%)
✅ 内存使用率:1.2GB / 8GB
✅ Cron 服务:运行中
✅ OpenClaw 网关:健康
✅ 日志文件:12MB
━━━━━━━━━━━━━━━━━━━━━━━━
✅ 所有检查通过
耗时:1.2秒
心跳(全部正常)
HEARTBEAT_OK
心跳(检测到问题)
🦞 心跳检查 · 2026-03-23 14:30:00
⚠️ 磁盘使用率:85%(超过80%)
✅ 内存使用率:2.1GB / 8GB
...
脚本
| 脚本 | 用途 | 频率 |
|---|
| l1fastcheck.py | 定义文件检查 | 对话前 |
| l2hourlycheck.py |
系统健康检查 | 每小时(定时任务) |
| l3
dailyaudit.py | 全面审计 | 每日08:00(定时任务) |
| heartbeat.py | 工作时段心跳 | 每30分钟(定时任务) |
命令行选项
bash
JSON 输出
python scripts/l2
hourlycheck.py --json
静默模式(仅返回退出码)
python scripts/l2
hourlycheck.py --quiet
强制输出(心跳)
python scripts/heartbeat.py --force
退出码
国际化
支持的语言:
自动检测系统语言环境。可通过以下方式覆盖:
bash
export OPENCLAW_LOCALE=zh-CN
python scripts/l2hourlycheck.py
系统要求
- - Python 3.8+
- Linux 或 macOS
- 无外部依赖(可选:rich 用于彩色输出,pyyaml 用于配置)
许可证
MIT
贡献指南
欢迎贡献!请先阅读 CONTRIBUTING.md。
更新日志
v1.0.0(2026-03-23)
- - 初始版本发布
- L1/L2/L3 检查
- 心跳机制
- 国际化支持(英文/简体中文)