HealthCheckPlugin Schema

Schema definition for the Health Check Plugin, which provides health monitoring endpoints for application status and readiness checks.

Schema Information

Property Value
Schema URL https://rustybeam.net/schema/HealthCheckPlugin
Parent Schema https://rustybeam.net/schema/UtilityPlugin
Description Health monitoring endpoints for application status and readiness checks

Properties

Property Type Cardinality Description
health_endpoint https://rustybeam.net/schema/Text 0..1 URL path for general health check endpoint. Defaults to "/health". Returns overall application health status.
ready_endpoint https://rustybeam.net/schema/Text 0..1 URL path for readiness check endpoint. Defaults to "/ready". Indicates if application is ready to receive traffic.
live_endpoint https://rustybeam.net/schema/Text 0..1 URL path for liveness check endpoint. Defaults to "/live". Indicates if application is alive and responding.
detailed_checks https://rustybeam.net/schema/Boolean 0..1 Whether to include detailed system information in health responses. Defaults to true. Shows disk space, memory, etc.
check_disk_space https://rustybeam.net/schema/Boolean 0..1 Whether to check available disk space as part of health checks. Defaults to true.
min_disk_space_mb https://rustybeam.net/schema/Number 0..1 Minimum required disk space in megabytes. If available space falls below this, health status becomes unhealthy. Defaults to 100MB.
name https://rustybeam.net/schema/Text 0..1 Plugin instance name for identification. Defaults to "health-check" if not specified.

Usage Examples

Basic Health Check (Default Endpoints)

<tr itemscope itemtype="https://rustybeam.net/schema/HealthCheckPlugin">
    <span itemprop="library">file://./plugins/librusty_beam_health_check.so</span>
</tr>

Custom Endpoints with Monitoring

<tr itemscope itemtype="https://rustybeam.net/schema/HealthCheckPlugin">
    <span itemprop="library">file://./plugins/librusty_beam_health_check.so</span>
    <span itemprop="health_endpoint">/status</span>
    <span itemprop="ready_endpoint">/ready</span>
    <span itemprop="live_endpoint">/ping</span>
    <span itemprop="detailed_checks">true</span>
    <span itemprop="check_disk_space">true</span>
    <span itemprop="min_disk_space_mb">500</span>
</tr>

Simple Health Check (No Details)

<tr itemscope itemtype="https://rustybeam.net/schema/HealthCheckPlugin">
    <span itemprop="library">file://./plugins/librusty_beam_health_check.so</span>
    <span itemprop="health_endpoint">/health</span>
    <span itemprop="detailed_checks">false</span>
    <span itemprop="check_disk_space">false</span>
    <span itemprop="name">simple_health</span>
</tr>

Kubernetes-style Health Checks

<tr itemscope itemtype="https://rustybeam.net/schema/HealthCheckPlugin">
    <span itemprop="library">file://./plugins/librusty_beam_health_check.so</span>
    <span itemprop="health_endpoint">/healthz</span>
    <span itemprop="ready_endpoint">/readiness</span>
    <span itemprop="live_endpoint">/liveness</span>
    <span itemprop="detailed_checks">true</span>
</tr>

Health Check Endpoints

Health Endpoint (/health)

Purpose: General application health status

Use Case: Overall application monitoring, load balancer health checks

GET /health
HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "healthy",
  "timestamp": "2025-07-10T14:30:45Z",
  "uptime_seconds": 3600,
  "checks": {
    "disk_space": "healthy",
    "memory": "healthy"
  },
  "details": {
    "disk_free_mb": 2048,
    "version": "1.0.0"
  }
}

Readiness Endpoint (/ready)

Purpose: Application readiness to receive traffic

Use Case: Kubernetes readiness probes, traffic routing decisions

GET /ready
HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "ready",
  "timestamp": "2025-07-10T14:30:45Z",
  "ready": true
}

Liveness Endpoint (/live)

Purpose: Application liveness check

Use Case: Kubernetes liveness probes, restart decisions

GET /live
HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "alive",
  "timestamp": "2025-07-10T14:30:45Z",
  "alive": true
}
HTTP Status Codes
Health check endpoints return:

Health Status Types

Status HTTP Code Description Action
Healthy 200 All systems operational Continue normal operations
Degraded 206 Some non-critical issues Monitor closely, may need attention
Unhealthy 503 Critical issues detected Stop traffic, investigate immediately

Schema Inheritance

This schema inherits from the UtilityPlugin schema, which provides:

And ultimately from the base Plugin schema, which provides:

System Checks Performed

When detailed_checks is enabled, the plugin performs these system checks:

Validation Rules

Plugin Pipeline Placement
The Health Check Plugin should be placed early in the plugin pipeline, before authentication plugins. This ensures health check endpoints are always accessible for monitoring, even if other services are down.

Monitoring Integration

Kubernetes Integration

apiVersion: v1
kind: Pod
spec:
  containers:
  - name: rusty-beam
    livenessProbe:
      httpGet:
        path: /live
        port: 3000
      initialDelaySeconds: 30
      periodSeconds: 10
    readinessProbe:
      httpGet:
        path: /ready
        port: 3000
      initialDelaySeconds: 5
      periodSeconds: 5

Docker Health Check

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD curl -f http://localhost:3000/health || exit 1

Load Balancer Integration

# nginx upstream health check
upstream backend {
    server backend1:3000;
    server backend2:3000;
    health_check uri=/ready;
}

Alerting and Monitoring

Prometheus Integration

Health check endpoints can be scraped by monitoring systems:

# Monitor health status
up{job="rusty-beam"} = 1 if /health returns 200
health_check_duration_seconds = response time for /health
disk_free_bytes = available disk space from /health details

Common Monitoring Queries

Integration with Other Plugins

Troubleshooting

Issue Symptom Solution
Health check fails 503 Service Unavailable Check disk space, system resources
Endpoint not responding 404 Not Found Verify endpoint path configuration
Always degraded status 206 Partial Content Adjust min_disk_space_mb threshold
Slow response High latency Disable detailed_checks or check system load

See Also