Endurance

Health check endpoints

A health check decides whether a Real Server is available. A server that fails its check is marked down and traffic goes to the rest; once it passes again it returns to service automatically.

Health checks

Get Health Check Scripts

GET /healthchecks

curl
curl -X GET "https://appliance.example.com/api/v1/healthchecks" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/healthchecks';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/healthchecks", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/healthchecks', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: List the health checks
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/healthchecks
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Health check scripts",
  "data": [
    {
      "name": "Test",
      "description": "Test script",
      "services": [
        "layer-7"
      ],
      "builtin": true
    },
    {
      "name": "Test2",
      "description": "Test2 script",
      "services": [
        "layer-7",
        "layer-4"
      ],
      "builtin": false
    }
  ]
}

Add a Health Check

POST /healthchecks

This change is staged. Send PUT /services/apply to apply it.

Body parameters
name string Required
description string Required
script string Required
services array Required
parameters array of object

What this check’s script accepts, one entry per parameter. Declarations only: the values belong to whatever references the check. Omit it and any lb-param headers in the script are read instead.

Fields
name string Required

Becomes the --name=value flag, so letters and digits only.

label string
type integer | port | path | hostname | string
required boolean

Mutually exclusive with a default, which is what makes a parameter optional.

default string
curl
curl -X POST "https://appliance.example.com/api/v1/healthchecks" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "description": "<description>",
  "script": "<script>",
  "services": [
    "<services>"
  ],
  "parameters": [
    {
      "name": "<name>",
      "label": "<label>",
      "type": "integer",
      "required": true,
      "default": "<default>"
    }
  ]
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/healthchecks';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'name' => '<name>',
    'description' => '<description>',
    'script' => '<script>',
    'services' => [
        '<services>',
    ],
    'parameters' => [
        [
            'name' => '<name>',
            'label' => '<label>',
            'type' => 'integer',
            'required' => true,
            'default' => '<default>',
        ],
    ],
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "name": "<name>",
    "description": "<description>",
    "script": "<script>",
    "services": [
        "<services>"
    ],
    "parameters": [
        {
            "name": "<name>",
            "label": "<label>",
            "type": "integer",
            "required": true,
            "default": "<default>"
        }
    ]
}

response = requests.post("https://appliance.example.com/api/v1/healthchecks", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/healthchecks', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "<name>",
  "description": "<description>",
  "script": "<script>",
  "services": [
    "<services>"
  ],
  "parameters": [
    {
      "name": "<name>",
      "label": "<label>",
      "type": "integer",
      "required": true,
      "default": "<default>"
    }
  ]
}),
});

const data = await response.json();
Bruno
meta {
  name: Create a health check
  type: http
  seq: 1
}

post {
  url: https://{{node-0}}:{{port}}/api/v1/healthchecks
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "name": "<name>",
    "description": "<description>",
    "script": "<script>",
    "services": [
      "<services>"
    ],
    "parameters": [
      {
        "name": "<name>",
        "label": "<label>",
        "type": "integer",
        "required": true,
        "default": "<default>"
      }
    ]
  }
}
Response
{
  "status": "success",
  "message": "Health check added successfully",
  "data": {
    "id": "5e1de37819dd5"
  }
}

Get the health check of a service

Get HealthChecks

GET /healthchecks/service/{service}

Path parameters
service string Required
curl
curl -X GET "https://appliance.example.com/api/v1/healthchecks/service/{service}" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/healthchecks/service/{service}';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/healthchecks/service/{service}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/healthchecks/service/{service}', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Get the health check of a service
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/healthchecks/service/{service}
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Health check scripts",
  "data": [
    {
      "name": "Test2",
      "description": "Test2 script",
      "services": [
        "layer-7",
        "layer-4"
      ]
    }
  ]
}

Health checks by ID

Get HealthChecks

GET /healthchecks/{id}

Path parameters
id string Required
curl
curl -X GET "https://appliance.example.com/api/v1/healthchecks/{id}" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/healthchecks/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/healthchecks/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/healthchecks/{id}', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Get a health check
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/healthchecks/{id}
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Health check",
  "data": [
    {
      "name": "Test2",
      "description": "Test2 script",
      "script": "testcheck2.sh",
      "services": [
        "layer-7",
        "layer-4"
      ]
    }
  ]
}

Edit a Health Check

PUT /healthchecks/{id}

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required

The id of the healthcheck.

Body parameters
name string Required
description string Required
script string Required
services array Required
parameters array of object

What this check’s script accepts, one entry per parameter. Declarations only: the values belong to whatever references the check. Omit it and any lb-param headers in the script are read instead.

Fields
name string Required

Becomes the --name=value flag, so letters and digits only.

label string
type integer | port | path | hostname | string
required boolean

Mutually exclusive with a default, which is what makes a parameter optional.

default string
curl
curl -X PUT "https://appliance.example.com/api/v1/healthchecks/{id}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "description": "<description>",
  "script": "<script>",
  "services": [
    "<services>"
  ],
  "parameters": [
    {
      "name": "<name>",
      "label": "<label>",
      "type": "integer",
      "required": true,
      "default": "<default>"
    }
  ]
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/healthchecks/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'name' => '<name>',
    'description' => '<description>',
    'script' => '<script>',
    'services' => [
        '<services>',
    ],
    'parameters' => [
        [
            'name' => '<name>',
            'label' => '<label>',
            'type' => 'integer',
            'required' => true,
            'default' => '<default>',
        ],
    ],
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "name": "<name>",
    "description": "<description>",
    "script": "<script>",
    "services": [
        "<services>"
    ],
    "parameters": [
        {
            "name": "<name>",
            "label": "<label>",
            "type": "integer",
            "required": true,
            "default": "<default>"
        }
    ]
}

response = requests.put("https://appliance.example.com/api/v1/healthchecks/{id}", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/healthchecks/{id}', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "<name>",
  "description": "<description>",
  "script": "<script>",
  "services": [
    "<services>"
  ],
  "parameters": [
    {
      "name": "<name>",
      "label": "<label>",
      "type": "integer",
      "required": true,
      "default": "<default>"
    }
  ]
}),
});

const data = await response.json();
Bruno
meta {
  name: Update a health check
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/healthchecks/{id}
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "name": "<name>",
    "description": "<description>",
    "script": "<script>",
    "services": [
      "<services>"
    ],
    "parameters": [
      {
        "name": "<name>",
        "label": "<label>",
        "type": "integer",
        "required": true,
        "default": "<default>"
      }
    ]
  }
}
Response
{
  "status": "success",
  "message": "Health check updated successfully",
  "data": {
    "id": "5e1de37819dd5"
  }
}

Delete HealthChecks

DELETE /healthchecks/{id}

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required
curl
curl -X DELETE "https://appliance.example.com/api/v1/healthchecks/{id}" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/healthchecks/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.delete("https://appliance.example.com/api/v1/healthchecks/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/healthchecks/{id}', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Delete a health check
  type: http
  seq: 1
}

delete {
  url: https://{{node-0}}:{{port}}/api/v1/healthchecks/{id}
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Health check deleted successfully"
}