Skip to content

Add health monitor for OpenClaw gateway and Hermes #11

Description

@IYENTeam

Summary

clawhip should monitor the health of OpenClaw gateway and Hermes agent, reporting failures to Discord when either service goes down.

Motivation

Currently health checks are done via OpenClaw cron jobs, which means if OpenClaw itself dies, the monitoring dies with it. clawhip runs as an independent process with its own Discord token, making it the right place for cross-service health monitoring.

Design

Config (config.toml)

[health_monitor]
enabled = true
interval_secs = 300  # 5 minutes

[[health_monitor.targets]]
name = "openclaw"
url = "http://localhost:18789/health"
expected_status = 200
report_channel = "1505821738586472498"  # #헤르메스

[[health_monitor.targets]]
name = "hermes"
url = "http://localhost:3000/status"
expected_status = 200
report_channel = "1486627737568546979"  # #밥벌이-하는-곳

Behavior

  • Poll each target at interval_secs
  • On success: silent (no output)
  • On failure (timeout/non-200/connection refused):
    • Post alert to configured report_channel via Discord API
    • Include: which service, error type, timestamp
    • Consecutive failure dedup: only alert on state change (healthy→unhealthy, unhealthy→healthy)
  • On recovery: post recovery message to same channel

Error Format

🚨 [health] openclaw DOWN — connection refused (localhost:18789)
  Since: 2026-05-19T21:30:00+09:00
  Consecutive failures: 3
✅ [health] openclaw RECOVERED — healthy after 15m downtime

Acceptance Criteria

  • New health_monitor config section parsed
  • Background task polls targets at configured interval
  • Alerts posted to correct Discord channel on state change
  • No duplicate alerts for consecutive failures
  • Recovery message posted when service comes back
  • Tests for health check logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions