health
فحص صحة نظام OpenClaw: Gateway، القنوات، الوكلاء، والخدمات.
الاستخدام
openclaw health openclaw health --verbose openclaw health --json
ما يفحصه
- Gateway - قيد التشغيل وقابل للوصول
- القنوات - متصلة ونشطة
- الوكلاء - الحالة والتوفر
- قاعدة البيانات - الاتصال والصحة
- API - نقاط النهاية متاحة
- الموارد - استخدام الذاكرة والقرص
مثال على المخرجات
عادي
✅ Gateway: Healthy (uptime: 3d 2h 15m) ✅ Channels: 3/3 connected ✅ Agents: 2 active ✅ Database: Healthy ✅ API: All endpoints responding ⚠️ Disk: 85% used (warning threshold)
JSON (--json)
{
"status": "healthy",
"timestamp": "2026-02-07T00:00:00Z",
"checks": {
"gateway": {
"status": "ok",
"uptime": 267900,
"version": "2.0.0"
},
"channels": {
"status": "ok",
"total": 3,
"connected": 3
},
"agents": {
"status": "ok",
"active": 2
},
"database": {
"status": "ok"
},
"api": {
"status": "ok"
},
"resources": {
"status": "warning",
"disk": {
"used": 85,
"total": 100,
"threshold": 80
}
}
}
}الخيارات
--verbose- مخرجات مفصلة--json- إخراج بتنسيق JSON--check- فحص محدد (gateway، channels، agents، database، api، resources)--wait- الانتظار حتى يصبح صحيًا (مفيد للنصوص)--timeout- مهلة الانتظار بالثواني (الافتراضي: 30)
فحص محدد
openclaw health --check gateway openclaw health --check channels openclaw health --check agents
رموز الحالة
0- صحي (جميع الفحوصات نجحت)1- تحذير (بعض الفحوصات أظهرت تحذيرات)2- غير صحي (فشلت فحوصات حرجة)
الاستخدام في النصوص:
#!/bin/bash if openclaw health --check gateway; then echo "Gateway is healthy" else echo "Gateway has issues" openclaw gateway restart fi
المراقبة
يمكن استخدام health للمراقبة الآلية:
# Cron job للتحقق كل 5 دقائق */5 * * * * openclaw health --json >> /var/log/openclaw-health.log # مع إشعارات */5 * * * * openclaw health || openclaw agent --to admin --message "Health check failed"
نقطة نهاية HTTP
يعرض Gateway أيضًا نقطة نهاية HTTP للفحص الصحي:
curl http://localhost:18789/health # مع تفاصيل curl http://localhost:18789/health?verbose=true
للتنبيه:
يمكن دمج health مع أنظمة المراقبة مثل Prometheus، Grafana، أو أي نظام مراقبة آخر عبر نقطة النهاية HTTP أو المخرجات JSON.
الفرق بين health و doctor
- health - فحص سريع للحالة الحالية (للمراقبة)
- doctor - تشخيص عميق مع إمكانية الإصلاح (لاستكشاف الأخطاء)