Skip to content
广告 · 本站推荐广告

openclaw health

执行快速健康检查,验证 OpenClaw 核心服务的运行状态。

命令签名

bash
openclaw health [选项]

选项

选项类型说明
--jsonbooleanJSON 格式输出
--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: healthy

JSON 输出(--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 }
  }
}

状态码

状态退出码说明
healthy0所有服务正常
degraded1部分服务异常但核心功能可用
unhealthy2核心服务不可用

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 流水线、启动脚本和监控系统中的健康探测。

另请参阅

基于MIT协议开源 | 内容翻译自 官方文档,同步更新