360 Secure SkillHub
360 安全技能中心

System Health

这是一款无LLM调用的本地系统健康监控工具,通过crontab定时执行。核心监控6项指标:Gateway响应、PM2/daemon状态、Docker健康、磁盘inode、RAM使用率、证书有效期,分临界与警告阈值。典型场景含查询系统健康、配置检查规则、排查告警、调整检查频率或新增检查项。可通过bash命令手动触发,输出为日志文件,临界状态自动推送告警至OpenClaw agent。

ciklopentan
ciklopentan
热度 20.18
最近更新 2026-04-06 12:16:48
分类:自动化依赖:代码执行 / 读写文件 / MCP 服务应用场景:DevOps / 自动化脚本 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add system-health
Metadata
name
system-health
description
Local system health monitoring without LLM API calls. Runs a slim OpenClaw-specific health loop (Gateway, PM2/deepseek-daemon, Docker, disk, RAM, daily cert expiry) via bash cron. Use when: (1) user asks "health", "status", "проверь систему", "мониторинг", (2) want to configure or review health checks, (3) investigating CRITICAL/WARNING alerts, (4) adjusting check frequency or adding/removing checks. Replaces LLM-based heartbeats with zero-API-cost local monitoring.

System Health — v3.0 (2026-04-06)

Local system monitoring skill. No LLM calls. Runs via system crontab.

Quick Usage

# Run now
bash ~/.openclaw/workspace/skills/system-health/scripts/health-check.sh

# See latest report
cat ~/.openclaw/workspace/logs/health-latest.md

# See history
tail -20 ~/.openclaw/workspace/logs/health-history.log

Checks

# Check Critical if Warning if
1 Gateway Not responding on localhost:18789 —
2 PM2 / deepseek-daemon daemon not online PM2 missing
3 Docker daemon unavailable or unhealthy containers —
4 Disk + inode ≥95% full/inode ≥85% full/inode
5 RAM ≥90% used ≥80% used
6 Cert expiry <7 days remaining (daily gate at 03:xx) —

Cron Setup

# Every 5 minutes
(crontab -l 2>/dev/null | grep -v 'health-check.sh'
echo '*/5 * * * * /usr/bin/env bash /home/irtual/.openclaw/workspace/skills/system-health/scripts/health-check.sh >> /home/irtual/.openclaw/workspace/logs/health-cron.log 2>&1'
) | crontab -

Alerting

When status = CRITICAL, the script calls:

openclaw system event --text "🔴 Health Check CRITICAL: ..." --mode now

This wakes the agent and routes the alert via configured channels.

Adding a Check

  1. Add a check_XXX function in scripts/health-check.sh
  2. Register it in the "Run checks" section
  3. Document in the table above

Pattern:

check_XXX() {
    # logic
    # CRITICAL+=("❌ ...") or WARNINGS+=("⚠️  ...") or OK_ITEMS+=("✅ ...")
}

Files

  • scripts/health-check.sh — main script (runs from cron)
  • ~/.openclaw/workspace/logs/health-latest.md — latest report (markdown)
  • ~/.openclaw/workspace/logs/health-history.log — append-only history (trimmed to last 1000 lines)
  • ~/.openclaw/workspace/logs/health-cron.log — cron execution output