Updated on 2025-09-28 GMT+08:00

Configuring a Health Check

Function

This API is used to configure a health check.

Constraints

This API has the following constraints:

  • The security groups must have rules that allow traffic to 100.125.0.0/16.

  • If you want to use UDP for health checks, ensure that the protocol of the backend server group is UDP.

Calling Method

For details, see Calling APIs.

URI

POST /v3/{project_id}/elb/healthmonitors

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Constraints: N/A

Range: The value can contain a maximum of 32 characters, including digits and lowercase letters.

Default value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: Specifies the token used for IAM authentication.

Constraints: N/A

Range: N/A

Default value: N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

healthmonitor

Yes

CreateHealthMonitorOption object

Definition: Specifies the request parameters for configuring a health check.

Constraints: N/A

Table 4 CreateHealthMonitorOption

Parameter

Mandatory

Type

Description

admin_state_up

No

Boolean

Definition: Specifies the administrative status of the health check.

Constraints: N/A

Range:

  • true: The health check function is enabled.

  • false: The health check function is disabled.

Default value: true

delay

Yes

Integer

Definition: Specifies the interval between health checks, in seconds.

Constraints: N/A

Range: 1 to 50

Default value: N/A

domain_name

No

String

Definition: Specifies the domain name that HTTP requests are sent to during the health check.

Constraints: This parameter is available only when type is set to HTTP or HTTPS.

Range: The value can contain only digits, letters, hyphens (-), and periods (.) and must start with a digit or letter.

Default value: The value is left blank by default, indicating that the virtual IP address of the load balancer is used as the destination address of HTTP requests.

expected_codes

No

String

Definition: Specifies the expected HTTP status code.

Constraints: This parameter will take effect only when type is set to HTTP, HTTPS or GRPC.

Range:

  • A specific value, for example, 200

  • A list of values that are separated with commas (,), for example, 200, 202

  • A value range, for example, 200-204

Default value: If type is set to GRPC, the default value is 0. If type is set to other protocols, the default value is 200.

http_method

No

String

Definition: Specifies the HTTP method.

Constraints: This parameter is available when type is set to HTTP or HTTPS.

Range: GET, HEAD, or POST

Default value: GET

max_retries

Yes

Integer

Definition: Specifies the number of consecutive health checks when the health check result of a backend server changes from OFFLINE to ONLINE.

Constraints: N/A

Range: 1 to 10

Default value: N/A

max_retries_down

No

Integer

Definition: Specifies the number of consecutive health checks when the health check result of a backend server changes from ONLINE to OFFLINE.

Constraints: N/A

Range: 1 to 10

Default value: N/A

monitor_port

No

Integer

Definition: Specifies the health check port.

Constraints:

  • This parameter is required if any_port_enable is set to true for the backend server group.

  • If the backend server group protocol is IP, monitor_port cannot be 0.

Range: 1 to 65535, or null (the port of a backend server will be used by default).

Default value: null

name

No

String

Definition: Specifies the health check name.

Constraints: N/A

Range: N/A

Default value: N/A

pool_id

Yes

String

Definition: Specifies the ID of the backend server group for which the health check is configured.

Constraints: N/A

Range: N/A

Default value: N/A

project_id

No

String

Specifies the project ID of the health check.

Constraints: N/A

Range: N/A

Default value: N/A

timeout

Yes

Integer

Definition: Specifies the maximum time required for waiting for a response from the health check, in seconds. It is recommended that you set the value less than that of parameter delay.

Constraints: N/A

Range: N/A

Default value: N/A

type

Yes

String

Definition: Specifies the health check protocol.

Constraints:

  • If the protocol of the backend server is QUIC, the value can only be UDP_CONNECT.

  • If the protocol of the backend server is UDP, the value can only be UDP_CONNECT.

  • If the protocol of the backend server is TCP, the value can only be TCP, HTTP, or HTTPS.

  • If the protocol of the backend server is IP, the value can only be TCP, HTTP, or HTTPS.

  • If the protocol of the backend server is HTTP, the value can only be TCP, HTTP, HTTPS, GRPC, or TLS.

  • If the protocol of the backend server is HTTPS, the value can only be TCP, HTTP, HTTPS, GRPC, or TLS.

  • If the protocol of the backend server is GRPC, the value can only be TCP, HTTP, HTTPS, GRPC, or TLS.

  • If the protocol of the backend server is TLS, the value can only be TCP, HTTP, HTTPS, GRPC, or TLS.

Range: The value can be TCP, UDP_CONNECT, HTTP, HTTPS, GRPC, or TLS.

Default value: N/A

QUIC protocol is not supported.

url_path

No

String

Definition: Specifies the HTTP request path for the health check. The value must start with a slash (/), and the default value is /.

Constraints: This parameter is available only when type is set to HTTP or HTTPS.

Range: The value can contain letters, digits, hyphens (-), slashes (/), periods (.), percentage signs (%), question marks (?), pound signs (#), ampersand signs (&), and the extended character set: _;~!()*[]@$^:',+.

Default value: N/A

Response Parameters

Status code: 201

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Definition: Specifies the request ID.

Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-).

healthmonitor

HealthMonitor object

Definition: Specifies the response parameters for configuring a health check.

Constraints: N/A

Table 6 HealthMonitor

Parameter

Type

Description

admin_state_up

Boolean

Definition: Specifies the administrative status of the health check.

Range:

  • true: The health check function is enabled.

  • false: The health check function is disabled.

delay

Integer

Definition: Specifies the interval between health checks, in seconds.

Range: 1 to 50

domain_name

String

Definition: Specifies the domain name that HTTP requests are sent to during the health check.

Range: The value can contain only digits, letters, hyphens (-), and periods (.) and must start with a digit or letter.

expected_codes

String

Definition: Specifies the expected HTTP status code.

Range:

  • A specific value, for example, 200

  • A list of values that are separated with commas (,), for example, 200, 202

  • A value range, for example, 200-204

http_method

String

Definition: Specifies the HTTP method.

Range: GET, HEAD, or POST

id

String

Specifies the health check ID.

Default value: N/A

max_retries

Integer

Definition: Specifies the number of consecutive health checks when the health check result of a backend server changes from OFFLINE to ONLINE.

Range: 1 to 10

max_retries_down

Integer

Definition: Specifies the number of consecutive health checks when the health check result of a backend server changes from ONLINE to OFFLINE.

Range: 1 to 10

monitor_port

Integer

Definition: Specifies the health check port.

Range: 1 to 65535, or null (the port of a backend server will be used by default).

name

String

Definition: Specifies the health check name.

Range: N/A

pools

Array of PoolRef objects

Specifies the IDs of the backend server groups for which the health check is configured. Only one ID will be returned.

Range: N/A

project_id

String

Definition: Specifies the project ID.

Range: N/A

timeout

Integer

Definition: Specifies the maximum time required for waiting for a response from the health check, in seconds.

Range: N/A

type

String

Definition: Specifies the health check protocol.

Range: The value can be TCP, UDP_CONNECT, HTTP, HTTPS, GRPC, or TLS.

url_path

String

Definition: Specifies the HTTP request path for the health check. The value must start with a slash (/), and the default value is /.

Range: The value can contain letters, digits, hyphens (-), slashes (/), periods (.), percentage signs (%), question marks (?), pound signs (#), ampersand signs (&), and the extended character set: _;~!()*[]@$^:',+.

created_at

String

Definition: Specifies the creation time.

Range: The value must be a UTC time in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

updated_at

String

Definition: Specifies the update time.

Range: The value must be a UTC time in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

Table 7 PoolRef

Parameter

Type

Description

id

String

Definition: Specifies the backend server group ID.

Range: N/A

Example Requests

  • Configuring a health check for an HTTP backend server group

    POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/healthmonitors
    
    {
      "healthmonitor" : {
        "name" : "My Healthmonitor",
        "max_retries" : 3,
        "pool_id" : "488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
        "type" : "HTTP",
        "timeout" : 30,
        "delay" : 1
      }
    }
  • Configuring a health check for an IP backend server group

    POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/healthmonitors
    
    {
      "healthmonitor" : {
        "name" : "My Healthmonitor",
        "max_retries" : 3,
        "pool_id" : "488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
        "type" : "HTTP",
        "timeout" : 30,
        "delay" : 1,
        "monitor_port" : 80
      }
    }

Example Responses

Status code: 201

Successful request.

{
  "request_id" : "0e837340-f1bd-4037-8f61-9923d0f0b19e",
  "healthmonitor" : {
    "monitor_port" : null,
    "id" : "c2b210b2-60c4-449d-91e2-9e9ea1dd7441",
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "domain_name" : null,
    "name" : "My Healthmonitor",
    "delay" : 1,
    "max_retries" : 3,
    "pools" : [ {
      "id" : "488acc50-6bcf-423d-8f0a-0f4184f5b8a0"
    } ],
    "admin_state_up" : true,
    "timeout" : 30,
    "type" : "HTTP",
    "expected_codes" : "200",
    "url_path" : "/",
    "http_method" : "GET"
  }
}

Status Codes

Status Code

Description

201

Successful request.

Error Codes

See Error Codes.