The Health-Check plugin provides HTTP endpoints for monitoring server health, readiness, and liveness. It enables external monitoring systems, load balancers, and orchestration platforms to check the server's operational status.
Modern infrastructure requires applications to expose their health status for automated monitoring and orchestration. The health-check plugin implements standard health check patterns with three types of checks: comprehensive health, liveness (is the server running?), and readiness (is the server ready to handle requests?). These endpoints are essential for Kubernetes deployments, load balancer health checks, and monitoring systems.
The health-check plugin is configured as part of the plugin pipeline in your host configuration:
<li itemprop="plugin" itemscope itemtype="https://rustybeam.net/schema/Plugin">
<span itemprop="library">file://./plugins/health-check.so</span>
<meta itemprop="health_endpoint" content="/health">
<meta itemprop="ready_endpoint" content="/ready">
<meta itemprop="live_endpoint" content="/live">
</li>
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
health_endpoint |
String | No | "/health" | URL path for comprehensive health check |
ready_endpoint |
String | No | "/ready" | URL path for readiness check |
live_endpoint |
String | No | "/live" | URL path for liveness check |
detailed_checks |
Boolean | No | true | Include detailed information in responses |
check_disk_space |
Boolean | No | true | Check available disk space |
min_disk_space_mb |
Integer | No | 100 | Minimum required disk space in MB |
Indicates if the server process is running and able to respond to requests:
curl http://localhost:3000/live
{
"status": "healthy",
"checks": ["Server is running"],
"timestamp": 1728569432
}
Indicates if the server is ready to handle requests:
curl http://localhost:3000/ready
{
"status": "healthy",
"checks": [
"Document root accessible: ./public",
"Disk space OK: 1024 MB available"
],
"timestamp": 1728569432
}
Comprehensive health status combining liveness and readiness:
curl http://localhost:3000/health
{
"status": "healthy",
"checks": [
"Server is running",
"Document root accessible: ./public",
"Disk space OK: 1024 MB available",
"Timestamp: 1728569432",
"Server: rusty-beam"
],
"timestamp": 1728569432
}
Status | HTTP Code | Description |
---|---|---|
healthy | 200 OK | All checks passed, server is fully operational |
degraded | 200 OK | Some checks failed but server can handle requests |
unhealthy | 503 Service Unavailable | Critical checks failed, server cannot handle requests properly |
Typical pipeline order:
1. health-check.so → Health endpoints ✓
2. basic-auth.so → Authentication (skips health checks)
3. authorization.so → Authorization
4. file-handler.so → Content serving
<li itemprop="plugin" itemscope itemtype="https://rustybeam.net/schema/Plugin">
<span itemprop="library">file://./plugins/health-check.so</span>
</li>
<li itemprop="plugin" itemscope itemtype="https://rustybeam.net/schema/Plugin">
<span itemprop="library">file://./plugins/health-check.so</span>
<meta itemprop="health_endpoint" content="/_health">
<meta itemprop="ready_endpoint" content="/_ready">
<meta itemprop="live_endpoint" content="/_live">
<meta itemprop="min_disk_space_mb" content="500">
</li>
<li itemprop="plugin" itemscope itemtype="https://rustybeam.net/schema/Plugin">
<span itemprop="library">file://./plugins/health-check.so</span>
<meta itemprop="detailed_checks" content="false">
<meta itemprop="check_disk_space" content="false">
</li>
apiVersion: v1
kind: Pod
spec:
containers:
- name: rusty-beam
image: rusty-beam:latest
livenessProbe:
httpGet:
path: /live
port: 3000
initialDelaySeconds: 10
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
version: '3.8'
services:
rusty-beam:
image: rusty-beam:latest
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
upstream backend {
server backend1.example.com:3000 max_fails=3 fail_timeout=30s;
server backend2.example.com:3000 max_fails=3 fail_timeout=30s;
}
location / {
proxy_pass http://backend;
}
location /health-check {
access_log off;
proxy_pass http://backend/ready;
proxy_read_timeout 5s;
}
# prometheus.yml
scrape_configs:
- job_name: 'rusty-beam'
metrics_path: '/health'
static_configs:
- targets: ['localhost:3000']
relabel_configs:
- source_labels: [__address__]
target_label: instance
replacement: 'rusty-beam-1'
#!/bin/bash
# health-monitor.sh
HEALTH_URL="http://localhost:3000/health"
ALERT_EMAIL="ops@example.com"
check_health() {
response=$(curl -s -w "\n%{http_code}" "$HEALTH_URL")
http_code=$(echo "$response" | tail -1)
body=$(echo "$response" | head -n -1)
if [ "$http_code" != "200" ]; then
echo "Health check failed with HTTP $http_code"
echo "$body" | mail -s "Rusty Beam Health Check Failed" "$ALERT_EMAIL"
return 1
fi
status=$(echo "$body" | jq -r '.status')
if [ "$status" = "degraded" ]; then
echo "Server is degraded"
echo "$body" | mail -s "Rusty Beam Degraded" "$ALERT_EMAIL"
fi
return 0
}
# Run check every minute
while true; do
check_health
sleep 60
done
Issue | Cause | Solution |
---|---|---|
404 on health endpoints | Wrong endpoint configuration or plugin not loaded | Check endpoint paths and plugin configuration |
Always returns unhealthy | Document root not accessible | Verify document root exists and has correct permissions |
Degraded due to disk space | Low disk space | Free up disk space or adjust min_disk_space_mb |
Authentication required | Health check after auth plugin | Move health-check before authentication plugins |
Cached responses | Proxy or CDN caching | Plugin sets no-cache headers, check proxy config |
Run the server with -v
flag to see health check details:
./rusty-beam -v config.html
Health check responses include these headers:
Content-Type: application/json
Cache-Control: no-cache, no-store, must-revalidate