Is the health-check API supported on routers?

Per the doc, routers support a healthChecks configuration:

However, is it possible to configure a web section on routers bound to a health-checks endpoint?
The doc seems to suggest that the health-checks in only supported on controllers:

I am little confused on how this works.

Yes, you can add health check configuration to the web section:

web:
  - name: health-check
    bindPoints:
      - interface: 127.0.0.1:8081
        address: 127.0.0.1:8081
    apis:
      - binding: health-checks

The health checks themselves are configured in a different section:

healthChecks:
  ctrlPingCheck:
    # How often to ping the controller over the control channel. Defaults to 30 seconds
    interval: 30s
    # When to timeout the ping. Defaults to 15 seconds
    timeout: 15s
    # How long to wait before pinging the controller. Defaults to 15 seconds
    initialDelay: 15s
  linkCheck:
    # Number of links required for the health check to be passing. Defaults to 0
    minLinks: 1
    # How often to check the link count, defaults to 5s
    interval: 5s
    # How long to wait before running the first check. Defaults to 1s
    initialDelay: 5s

Finally, note that you will likely see a spurious warning. See Enabling any health check causes WARNING to be logged · Issue #2424 · openziti/ziti · GitHub

Hope that's helpful,
Paul

Thank you @plorenz .

@plorenz is there a reference for the health-check APIs for both the controller and router?

Trying to understand what endpoints are available. Can't seem to find a spec for the APIs in the docs or repos.

It's a simple endpoint. We have unfortunately not created a spec for it, but the code is here:

Here's example output on the controller:

$ curl -k https://localhost:1280/health-checks/
{
    "data": {
        "checks": [
            {
                "details": null,
                "healthy": true,
                "id": "bolt.read",
                "lastCheckDuration": "16.149µs",
                "lastCheckTime": "2024-10-01T14:04:14Z"
            }
        ],
        "healthy": true
    },
    "meta": {}
}

Example output from the edge router

$ curl -k https://localhost:8081/health-checks/
{
    "data": {
        "checks": [
            {
                "details": null,
                "healthy": true,
                "id": "link.health",
                "lastCheckDuration": "39.784µs",
                "lastCheckTime": "2024-10-01T14:07:24Z"
            },
            {
                "details": null,
                "healthy": true,
                "id": "controllerPing",
                "lastCheckDuration": "4.255µs",
                "lastCheckTime": "2024-10-01T14:07:28Z"
            }
        ],
        "healthy": true
    },
    "meta": {}
}

Cheers,
Paul

1 Like