Skip to content

健康检查(CLI)

简明指南:无需猜测,快速验证渠道连接状态。

快速检查

  • openclaw status — 本地摘要:Gateway 可达性/模式、更新提示、已绑定渠道的认证时长、会话及近期活动。
  • openclaw status --all — 完整本地诊断(只读、彩色输出,可安全粘贴分享)。
  • openclaw status --deep — 同时探测正在运行的 Gateway(支持时会对每个渠道发起探测)。
  • openclaw health --json — 向正在运行的 Gateway 请求完整健康快照(仅 WS;不直接访问 Baileys Socket)。
  • 在 WhatsApp/WebChat 中单独发送 /status 消息,无需调用 Agent 即可获得状态回复。
  • 日志:追踪 /tmp/openclaw/openclaw-*.log,过滤关键词 web-heartbeatweb-reconnectweb-auto-replyweb-inbound

深度诊断

  • 检查磁盘上的凭据:ls -l ~/.openclaw/credentials/whatsapp/<accountId>/creds.json(mtime 应为近期)。
  • 会话存储:ls -l ~/.openclaw/agents/<agentId>/sessions/sessions.json(路径可在配置中覆盖)。会话数量和最近收件人通过 status 命令展示。
  • 重新绑定流程:当日志中出现状态码 409–515 或 loggedOut 时,执行 openclaw channels logout && openclaw channels login --verbose。(注意:QR 登录流程在配对码绑定后状态 515 时会自动重试一次。)

健康监控配置

  • gateway.channelHealthCheckMinutes:Gateway 检查渠道健康的频率,默认 5,设为 0 可全局禁用健康监控重启。
  • gateway.channelStaleEventThresholdMinutes:已连接渠道在多长时间内无活动后被健康监控视为"陈旧"并触发重启,默认 30,应不小于 gateway.channelHealthCheckMinutes
  • gateway.channelMaxRestartsPerHour:每渠道/账号在滚动 1 小时内的健康监控重启上限,默认 10
  • channels.<provider>.healthMonitor.enabled:为特定渠道禁用健康监控重启,同时保留全局监控。
  • channels.<provider>.accounts.<accountId>.healthMonitor.enabled:多账号覆盖,优先级高于渠道级配置。
  • 以上渠道级覆盖适用于目前已内置渠道监控的渠道:Discord、Google Chat、iMessage、Microsoft Teams、Signal、Slack、Telegram 和 WhatsApp。

出现故障时

  • logged out 或状态码 409–515 → 重新绑定:openclaw channels logout 然后 openclaw channels login
  • Gateway 不可达 → 启动:openclaw gateway --port 18789(端口被占用时加 --force)。
  • 收不到消息 → 确认绑定的手机在线,且发送方已被允许(channels.whatsapp.allowFrom);群聊时还需核对白名单和提及规则(channels.whatsapp.groupsagents.list[].groupChat.mentionPatterns)。

专用 health 命令

openclaw health --json 向正在运行的 Gateway 请求健康快照(CLI 不直接访问渠道 Socket)。

返回内容包括:已绑定凭据/认证时长、各渠道探测摘要、会话存储摘要和探测耗时。

若 Gateway 不可达或探测失败/超时,命令以非零退出码结束。使用 --timeout <ms> 可覆盖默认的 10s 超时。