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

Querying Health Checks

Function

This API is used to query all health checks.

Constraints

This API has the following constraints:

  • Parameters marker, limit, and page_reverse are used for pagination query.

  • Parameters marker and page_reverse take effect only when they are used together with parameter limit.

Calling Method

For details, see Calling APIs.

URI

GET /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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

marker

No

String

Definition: Specifies the ID of the last record on the previous page.

Constraints:

  • This parameter must be used together with limit.

  • If the parameter is not specified, only resources on the first page are queried.

  • This parameter cannot be left blank or set to an invalid ID.

Range: N/A

Default value: N/A

limit

No

Integer

Definition: Specifies the number of records returned on each page.

Constraints: N/A

Range: 0 to 2000

Default value: 2000

page_reverse

No

Boolean

Definition: Specifies whether to use reverse query.

Constraints:

  • This parameter must be used together with limit.

  • If page_reverse is set to true and you want to query the resources on the previous page, set the value of marker to the value of previous_marker.

Range:

  • true: Query resources on the previous page.

  • false: Query resources on the next page.

Default value: false

id

No

Array of strings

Definition: Specifies the health check ID.

Multiple IDs can be used for query in the format of id=xxx&id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

monitor_port

No

Array of integers

Definition: Specifies the port used for the health check.

Multiple ports can be used for query in the format of monitor_port=xxx&monitor_port=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

domain_name

No

Array of strings

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

Multiple domain names can be used for query in the format of domain_name=xxx&domain_name=xxx.

Constraints: N/A

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

Default value: N/A

name

No

Array of strings

Definition: Specifies the health check name.

Multiple names can be used for query in the format of name=xxx&name=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

delay

No

Array of integers

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

Multiple intervals can be used for query in the format of delay=xxx&delay=xxx.

Constraints: N/A

Range: 1 to 50

Default value: N/A

max_retries

No

Array of integers

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

Multiple values can be used for query in the format of max_retries=xxx&max_retries=xxx.

Constraints: N/A

Range: 1 to 10

Default value: N/A

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: N/A

max_retries_down

No

Array of integers

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

Multiple values can be used for query in the format of max_retries_down=xxx&max_retries_down=xxx.

Constraints: N/A

Range: 1 to 10

Default value: N/A

timeout

No

Integer

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

Constraints: N/A

Range: N/A

Default value: N/A

type

No

Array of strings

Definition: Specifies the health check protocol.

Multiple protocols can be used for query in the format of type=xxx&type=xxx.

Constraints: N/A

Range: TCP, UDP_CONNECT, HTTP, HTTPS, TLS, or GRPC

Default value: N/A

expected_codes

No

Array of strings

Definition: Specifies the expected HTTP status code.

Multiple status codes can be used for query in the format of expected_codes=xxx&expected_codes=xxx.

Constraints: N/A

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: N/A

url_path

No

Array of strings

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

Multiple paths can be used for query in the format of url_path=xxx&url_path=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

http_method

No

Array of strings

Definition: Specifies the HTTP method.

Multiple methods can be used for query in the format of http_method=xxx&http_method=xxx.

Constraints: N/A

Range: GET, HEAD, or POST

Default value: N/A

enterprise_project_id

No

Array of strings

Definition: Specifies the ID of the enterprise project.

Multiple values can be used for query in the format of:

enterprise_project_id=xxx&enterprise_project_id=xxx.

Constraints:

  • If enterprise_project_id is not specified, resources in all enterprise projects are queried by default. Fine-grained authorization is performed. The elb:healthmonitors:list permission must be assigned to the user group.

  • If enterprise_project_id is specified, the value can be a specific enterprise project ID or all_granted_eps. If the value is a specific enterprise project ID, only resources in the enterprise project are queried. If the value is all_granted_eps, resources in the enterprise projects with the elb:healthmonitors:list permission are queried.

Range: N/A

Default value: N/A

Request Parameters

Table 3 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

Response Parameters

Status code: 200

Table 4 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 (-).

page_info

PageInfo object

Definition: Specifies the pagination information.

healthmonitors

Array of HealthMonitor objects

Definition: Specifies the health check.

Table 5 PageInfo

Parameter

Type

Description

previous_marker

String

Definition: Specifies the ID of the first record in the pagination query result. If page_reverse is set to true, this parameter is used together to query resources on the previous page.

Range: N/A

next_marker

String

Definition: Specifies the ID of the last record in the pagination query result. It is usually used to query resources on the next page.

Range: N/A

current_count

Integer

Definition: Specifies the number of records returned on the current page.

Range: 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'.

Note: This parameter will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers.

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'.

Note: This parameter will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers.

Table 7 PoolRef

Parameter

Type

Description

id

String

Definition: Specifies the backend server group ID.

Range: N/A

Example Requests

Querying health checks

GET https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/healthmonitors

Example Responses

Status code: 200

Successful request.

{
  "healthmonitors" : [ {
    "monitor_port" : null,
    "id" : "c2b210b2-60c4-449d-91e2-9e9ea1dd7441",
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "domain_name" : null,
    "name" : "My Healthmonitor update",
    "delay" : 10,
    "max_retries" : 10,
    "pools" : [ {
      "id" : "488acc50-6bcf-423d-8f0a-0f4184f5b8a0"
    } ],
    "admin_state_up" : true,
    "timeout" : 30,
    "type" : "HTTP",
    "expected_codes" : "200",
    "url_path" : "/",
    "http_method" : "GET"
  }, {
    "monitor_port" : null,
    "id" : "cda1af03-0660-4fd2-8edf-e38c79846e08",
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "domain_name" : "akik..un.com",
    "name" : "lijunqiu",
    "delay" : 50,
    "max_retries" : 1,
    "pools" : [ {
      "id" : "ae6e45ba-be84-4074-8ac6-bc4a56484809"
    } ],
    "admin_state_up" : false,
    "timeout" : 3,
    "type" : "UDP_CONNECT",
    "expected_codes" : null,
    "url_path" : "/world",
    "http_method" : null
  } ],
  "page_info" : {
    "next_marker" : "cda1af03-0660-4fd2-8edf-e38c79846e08",
    "previous_marker" : "c2b210b2-60c4-449d-91e2-9e9ea1dd7441",
    "current_count" : 2
  },
  "request_id" : "814bc40e-8b0a-4ced-b8e5-f136c3e1df6a"
}

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
import com.huaweicloud.sdk.elb.v3.*;
import com.huaweicloud.sdk.elb.v3.model.*;


public class ListHealthMonitorsSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        ElbClient client = ElbClient.newBuilder()
                .withCredential(auth)
                .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                .build();
        ListHealthMonitorsRequest request = new ListHealthMonitorsRequest();
        try {
            ListHealthMonitorsResponse response = client.listHealthMonitors(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkelb.v3 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = ElbClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ElbRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListHealthMonitorsRequest()
        response = client.list_health_monitors(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := elb.NewElbClient(
        elb.ElbClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListHealthMonitorsRequest{}
	response, err := client.ListHealthMonitors(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Successful request.

Error Codes

See Error Codes.