openclaw health
执行快速健康检查,验证 OpenClaw 核心服务的运行状态。
命令签名
bash
openclaw health [选项]选项
| 选项 | 类型 | 说明 |
|---|---|---|
--json | boolean | JSON 格式输出 |
--endpoint <url> | string | 检查指定端点的健康状态 |
--timeout <ms> | number | 超时时间(默认 5000) |
说明
openclaw health 是一个轻量级的健康检查命令,用于快速确认系统的核心服务是否正常运行。与 openclaw doctor 的全面诊断不同,health 侧重于运行时状态的快速探测。
检查内容
| 服务 | 检查方式 |
|---|---|
| 守护进程 | 检查进程是否运行 |
| 网关 | HTTP 健康端点探测 |
| Agent | 活跃 Agent 响应检查 |
| 渠道 | 渠道连接状态 |
输出格式
bash
openclaw health✔ Daemon running (PID: 12345)
✔ Gateway healthy (http://localhost:18789)
✔ Agent 1 active
✔ Channels 2/3 connected
Overall: healthyJSON 输出(--json):
json
{
"status": "healthy",
"checks": {
"daemon": { "status": "ok", "pid": 12345 },
"gateway": { "status": "ok", "url": "http://localhost:18789", "latency": 12 },
"agents": { "status": "ok", "active": 1 },
"channels": { "status": "degraded", "connected": 2, "total": 3 }
}
}状态码
| 状态 | 退出码 | 说明 |
|---|---|---|
healthy | 0 | 所有服务正常 |
degraded | 1 | 部分服务异常但核心功能可用 |
unhealthy | 2 | 核心服务不可用 |
HTTP 健康端点
网关运行时,提供 HTTP 健康检查端点:
GET http://localhost:18789/health可集成到外部监控系统(如 Prometheus、Uptime Robot)。
示例
bash
# 快速健康检查
openclaw health
# JSON 输出(供脚本使用)
openclaw health --json
# 检查远程实例
openclaw health --endpoint http://192.168.1.10:18789
# 设置超时
openclaw health --timeout 3000
# 在脚本中使用退出码
openclaw health && echo "系统正常" || echo "系统异常"TIP
openclaw health 适合用于 CI/CD 流水线、启动脚本和监控系统中的健康探测。
另请参阅
openclaw doctor— 全面系统诊断openclaw daemon— 守护进程管理openclaw gateway— 网关控制
