Health Check

GET /api/v1/health

Performs deep health checks against PostgreSQL, NATS, and backend service heartbeats. Returns component-level status.

Components:

Heartbeat statuses: ok (last seen <45s), degraded (45–120s), unhealthy (>120s or never seen). Engine is critical — unhealthy engine degrades overall status.

Response (all healthy): 200 OK

{
  "status": "ok",
  "components": {
    "database": {
      "status": "ok",
      "latency_ms": 2
    },
    "nats": {
      "status": "ok"
    },
    "engine": {
      "status": "ok",
      "last_heartbeat_seconds_ago": 12
    },
    "collector-manager": {
      "status": "ok",
      "last_heartbeat_seconds_ago": 8
    },
    "snmp-poller": {
      "status": "ok",
      "last_heartbeat_seconds_ago": 3
    }
  }
}

Response (degraded): 503 Service Unavailable

{
  "status": "degraded",
  "components": {
    "database": {
      "status": "ok",
      "latency_ms": 1
    },
    "nats": {
      "status": "ok"
    },
    "engine": {
      "status": "unhealthy"
    },
    "collector-manager": {
      "status": "ok",
      "last_heartbeat_seconds_ago": 5
    },
    "snmp-poller": {
      "status": "ok",
      "last_heartbeat_seconds_ago": 10
    }
  }
}

Returns 200 when all components are healthy, 503 when any component is unhealthy or engine is unhealthy. The latency_ms field is included for database checks. The last_heartbeat_seconds_ago field is included for heartbeat-based services when at least one heartbeat has been received.