Health Check Commands

The nself health command provides comprehensive health check management for your ɳSelf infrastructure. Monitor service health, check endpoints, and track health history.

Updated for ɳSelf v0.4.8

Health Monitoring (v0.4.6+)

  • - Service Health: Check container and service health
  • - Endpoint Testing: Verify HTTP endpoints
  • - Watch Mode: Continuous health monitoring
  • - Health History: Track health check history

Health Status

nself health

Check overall system health (default command).

nself health                    # Check all services
nself health check              # Same as above

# Output:
#   ➞ Service Health
#
#   Service              Status       Time     Details
#   -------              ------       ----     -------
#   postgres             ✓ healthy    12ms     Container healthy
#   hasura               ✓ healthy    8ms      Container healthy
#   auth                 ✓ healthy    15ms     Container healthy
#   nginx                ● running    3ms      No health check defined
#
#   ➞ Endpoint Health
#
#   Endpoint             Status       Time     HTTP
#   --------             ------       ----     ----
#   api                  healthy      45ms     HTTP 200
#   auth                 healthy      32ms     HTTP 200
#
#   ➞ Summary
#   Healthy: 4/4
#
#   ✓ All services healthy

nself health service

Check specific service health.

nself health service <name>

# Examples
nself health service postgres   # Check PostgreSQL
nself health service hasura     # Check Hasura
nself health service auth       # Check auth service

nself health endpoint

Check custom endpoint health.

nself health endpoint <url>

# Example
nself health endpoint https://api.example.com/health

Continuous Monitoring

nself health watch

Continuous health monitoring.

nself health watch              # Monitor every 10s
nself health watch --interval 5 # Monitor every 5s

# Press Ctrl+C to stop

Health History

nself health history

Show health check history.

nself health history            # Recent history
nself health history --limit 50 # Last 50 checks

# Output:
# Health History (last 24h)
# ========================
# TIME                SERVICE    STATUS    LATENCY
# 2026-01-23 10:30    postgres   healthy   2ms
# 2026-01-23 10:00    postgres   healthy   3ms
# 2026-01-23 09:30    postgres   healthy   2ms
# ...

Configuration

nself health config

Show health check configuration.

nself health config             # Current settings

Options

OptionDescriptionDefault
--timeout NHealth check timeout (seconds)30
--interval NCheck interval for watch mode10
--retries NNumber of retries on failure3
--env NAMECheck health in specific environmentcurrent
--jsonOutput in JSON formatfalse
--quietOnly output on failurefalse

Health States

StateIconDescription
healthyService is healthy
runningRunning without health check defined
startingHealth check pending
unhealthyHealth check failed
stopped-Container not running
not_found-Container does not exist

JSON Output

nself health --json

# Output:
{
  "timestamp": "2026-01-23T10:30:00Z",
  "healthy": 4,
  "unhealthy": 0,
  "total": 4,
  "services": [
    {"service": "postgres", "status": "healthy", "response_time_ms": 12}
  ]
}

Environment Variables

VariableDescriptionDefault
HEALTH_TIMEOUTDefault timeout (seconds)30
HEALTH_RETRIESDefault retries3
HEALTH_INTERVALDefault interval (seconds)10

Usage Examples

# Quick health check
nself health

# Check specific service
nself health service postgres

# Continuous monitoring
nself health watch --interval 5

# Check staging environment
nself health --env staging

# JSON output for tooling
nself health --json

# Quiet mode (only show failures)
nself health --quiet

Subcommands Reference

SubcommandDescription
checkRun all health checks (default)
service <name>Check specific service
endpoint <url>Check custom endpoint
watchContinuous monitoring
historyCheck history
configHealth configuration

Next Steps