Health Monitor

Manage health checks for address group members. Uses the existing Health Monitor system.

Get Health Status

curl -s https://api.1bytedns.ru/client/v1/zones/42/address_groups/5/health \
  -H "Authorization: Bearer TOKEN" | python3 -m json.tool
{
  "success": true,
  "result": {
    "enabled": true,
    "probe_type": "HTTP",
    "probe_port": 80,
    "probe_path": "/health",
    "expected_status": 200,
    "check_interval_sec": 30,
    "unhealthy_threshold": 3,
    "healthy_threshold": 2,
    "targets": [
      {
        "address": "192.0.2.1",
        "healthy": true,
        "consecutive_ok": 5,
        "consecutive_fail": 0,
        "last_checked_on": "2024-06-01T10:30:00Z"
      },
      {
        "address": "192.0.2.2",
        "healthy": false,
        "consecutive_ok": 0,
        "consecutive_fail": 3,
        "last_checked_on": "2024-06-01T10:29:50Z"
      }
    ]
  },
  "errors": [],
  "messages": []
}

When no config exists, returns defaults: enabled: false, check_interval_sec: 30, unhealthy_threshold: 3, healthy_threshold: 2, empty targets.

Configure Health Monitoring

curl -s -X PATCH https://api.1bytedns.ru/client/v1/zones/42/address_groups/5/health \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "probe_type": "HTTP",
    "probe_port": 80,
    "probe_path": "/health",
    "expected_status": 200,
    "check_interval_sec": 30,
    "unhealthy_threshold": 3,
    "healthy_threshold": 2
  }' | python3 -m json.tool

Body Parameters:

FieldTypeRequiredDescription
enabledbooleanYesEnable/disable monitoring
probe_typestringConditionalTCP, HTTP, HTTPS, ICMP (required if enabled: true)
probe_portintConditionalPort 1-65535 (required for TCP/HTTP/HTTPS; ignored for ICMP)
probe_pathstringConditionalURL path (HTTP/HTTPS only; ignored for TCP/ICMP)
expected_statusintConditionalExpected HTTP status (HTTP/HTTPS only; ignored for TCP/ICMP)
check_interval_secintNoCheck interval (default: 30)
unhealthy_thresholdintNoConsecutive failures to mark unhealthy (default: 3)
healthy_thresholdintNoConsecutive successes to mark healthy (default: 2)

Health Check History

curl -s "https://api.1bytedns.ru/client/v1/zones/42/address_groups/5/health_checks?limit=20" \
  -H "Authorization: Bearer TOKEN" | python3 -m json.tool
{
  "success": true,
  "result": [
    {"address": "192.0.2.1", "healthy": true, "duration_ms": 15, "error_message": null, "checked_on": "2024-06-01T10:30:00Z"},
    {"address": "192.0.2.2", "healthy": false, "duration_ms": 5000, "error_message": "Connection timeout", "checked_on": "2024-06-01T10:29:50Z"}
  ],
  "errors": [],
  "messages": []
}

Failover Events

curl -s "https://api.1bytedns.ru/client/v1/zones/42/address_groups/5/failover_events?limit=20" \
  -H "Authorization: Bearer TOKEN" | python3 -m json.tool
{
  "success": true,
  "result": [
    {
      "id": 1,
      "address": "192.0.2.1",
      "reason": "consecutive_failures_threshold_reached",
      "created_on": "2024-06-01T10:25:00Z"
    }
  ],
  "errors": [],
  "messages": []
}

Health Bar

Quick health summary for UI display.

curl -s https://api.1bytedns.ru/client/v1/zones/42/address_groups/5/healthbar \
  -H "Authorization: Bearer TOKEN" | python3 -m json.tool
{
  "success": true,
  "result": {
    "healthy_count": 2,
    "unhealthy_count": 1,
    "total_count": 3,
    "color": "yellow",
    "label": "2/3 healthy"
  },
  "errors": [],
  "messages": []
}

Color Logic:

ColorCondition
gray0 total members
greenAll members healthy
redNo members healthy
yellowPartial (some healthy, some not)

Members with healthy = null are counted as unhealthy (conservative approach).

Last updated: 2026-06-26