All Products
Search
Document Center

Server Load Balancer:GetListenerHealthStatus

Last Updated:Sep 11, 2024

Queries the health check status of a listener and its forwarding rules.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
alb:GetListenerHealthStatusget
  • LoadBalancer
    acs:alb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ListenerIdstringYes

The listener ID.

lsr-bp1bpn0kn908w4nbw****
IncludeRulebooleanNo

Specifies whether to return the health check results of forwarding rules. Valid values:

  • true
  • false (default)
true
NextTokenstringNo

The token that determines the start point of the query. Valid values:

  • If this is your first query or no next queries are to be sent, ignore this parameter.
  • If a next query is to be sent, set the value to the value of NextToken that is returned from the last call.
FFmyTO70tTpLG6I3FmYAXGKPd****
MaxResultslongNo

The number of entries to return on each page. Valid values: 1 to 30. Default value: 20.

20

Response parameters

ParameterTypeDescriptionExample
object

Query the health check status of the listener and its forwarding rules.

ListenerHealthStatusarray<object>

The health check status of the server groups that are associated with the listener.

object

The health check status of the server groups that are associated with the listener.

ListenerIdstring

The listener ID.

lsr-bp1bpn0kn908w4nbw****
ListenerPortinteger

The listener port.

80
ListenerProtocolstring

The listener protocol.

http
ServerGroupInfosarray<object>

The information about the server group.

object

The information about the server group.

HealthCheckEnabledstring

Indicates whether health checks are enabled. If on is returned, it indicates that health checks are enabled.

on
NonNormalServersarray<object>

A list of unhealthy backend servers.

object

A list of unhealthy backend servers.

Portinteger

The backend port.

90
Reasonobject

The cause of the abnormal state.

ActualResponsestring

The HTTP status code returned from the server, for example, 302.

Note A value is returned only if ReasonCode is set to RESPONSE_MISMATCH.
302
ExpectedResponsestring

The HTTP status code returned after backend servers pass health checks.

Valid values: HTTP_2xx, HTTP_3xx, HTTP_4xx, and HTTP_5xx. Multiple status codes are separated by commas (,).

Note This value is returned only if ReasonCode is set to RESPONSE_MISMATCH.
HTTP_2xx
ReasonCodestring

The reason why the value of Status is Unhealthy. Only HTTP and HTTPS listeners support this parameter.

  • CONNECT_TIMEOUT: ALB failed to connect to the backend server within the specified period of time.
  • CONNECT_FAILED: ALB failed to connect to the backend server.
  • RECV_RESPONSE_FAILED: ALB failed to receive a response from the backend server.
  • RECV_RESPONSE_TIMEOUT: ALB failed to receive a response from the backend server within the specified period of time.
  • SEND_REQUEST_FAILED: ALB failed to send a request to the backend server.
  • SEND_REQUEST_TIMEOUT: ALB failed to send a request to the backend server within the specified period of time.
  • RESPONSE_FORMAT_ERROR: The format of the response from the backend server is invalid.
  • RESPONSE_FORMAT_ERROR: The HTTP status code returned from the backend server is not the expected one.
RESPONSE_MISMATCH
ServerIdstring

The ID of the backend server.

rg-bp1bfa08ex*****
ServerIpstring

The IP address of the backend server.

192.168.8.10
Statusstring

The status of the health check. Valid values: Valid values:

  • Initial: indicates that health checks are configured for the NLB instance, but no data was found.
  • Unhealthy: indicates that the backend server consecutively fails health checks.
  • Unused: indicates that the weight of the backend server is 0.
  • Unavailable: indicates that health checks are disabled.
Initial
ServerGroupIdstring

The ID of the server group that is associated with the listener.

vsp-bp1qjwo61pqz3ahltv****
ActionTypestring

The action specified for the server group. Valid values:

  • ForwardGroup: distributes requests to server groups.
  • TrafficMirror: mirrors requests to server groups.
TrafficMirror
RequestIdstring

The request ID.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984
RuleHealthStatusarray<object>

The health check status of the forwarding rules.

object

The health check status of the forwarding rule.

RuleIdstring

The ID of the forwarding rule.

rule-hp34s2h0xx1ht4nwo****
ServerGroupInfosarray<object>

The server groups.

object

The configurations of the server groups.

HealthCheckEnabledstring

Indicates whether health checks are enabled. If on is returned, it indicates that health checks are enabled.

on
NonNormalServersarray<object>

A list of unhealthy backend servers.

object

A list of unhealthy backend servers.

Portinteger

The backend port.

90
Reasonobject

The cause of the abnormal state.

ActualResponsestring

The HTTP status code returned from the server, for example, 302.

Note A value is returned only if ReasonCode is set to RESPONSE_MISMATCH.
302
ExpectedResponsestring

The HTTP status code returned after backend servers pass health checks.

Valid values: HTTP_2xx, HTTP_3xx, HTTP_4xx, and HTTP_5xx. Multiple status codes are separated by commas (,).

Note A value is returned only if ReasonCode is set to RESPONSE_MISMATCH.
HTTP_2xx
ReasonCodestring

The reason why the value of Status is Unhealthy. Only HTTP and HTTPS listeners support this parameter.

  • CONNECT_TIMEOUT: ALB failed to connect to the backend server within the specified period of time.
  • CONNECT_FAILED: ALB failed to connect to the backend server.
  • RECV_RESPONSE_FAILED: ALB failed to receive a response from the backend server.
  • RECV_RESPONSE_TIMEOUT: ALB failed to receive a response from the backend server within the specified period of time.
  • SEND_REQUEST_FAILED: ALB failed to send a request to the backend server.
  • SEND_REQUEST_TIMEOUT: ALB failed to send a request to the backend server within the specified period of time.
  • RESPONSE_FORMAT_ERROR: The format of the response from the backend server is invalid.
  • RESPONSE_FORMAT_ERROR: The HTTP status code returned from the backend server is not the expected one.
RESPONSE_MISMATCH
ServerIdstring

The ID of the backend server.

rg-bp1bfa08ex****
ServerIpstring

The IP address of the server group.

192.168.2.11
Statusstring

The status of the health check. Valid values: Valid values:

  • Initial: indicates that health checks are configured for the NLB instance, but no data was found.
  • Unhealthy: indicates that the backend server consecutively fails health checks.
  • Unused: indicates that the weight of the backend server is 0.
  • Unavailable: indicates that health checks are disabled.
Initial
ServerGroupIdstring

The ID of the server group that is associated with the listener.

vsp-bp1qjwo61pqz3ahlt****
ActionTypestring

The action specified for the server group.

TrafficMirror
NextTokenstring

The pagination token that is used in the next request to retrieve a new page of results. Valid values:

  • If NextToken is empty, no next page exists.
  • If NextToken was returned in the previous query, specify the value to obtain the next set of results.
FFmyTO70tTpLG6I3FmYAXGKPd****

Examples

Sample success responses

JSONformat

{
  "ListenerHealthStatus": [
    {
      "ListenerId": "lsr-bp1bpn0kn908w4nbw****",
      "ListenerPort": 80,
      "ListenerProtocol": "http",
      "ServerGroupInfos": [
        {
          "HealthCheckEnabled": "on",
          "NonNormalServers": [
            {
              "Port": 90,
              "Reason": {
                "ActualResponse": "302",
                "ExpectedResponse": "HTTP_2xx",
                "ReasonCode": "RESPONSE_MISMATCH"
              },
              "ServerId": "rg-bp1bfa08ex*****",
              "ServerIp": "192.168.8.10",
              "Status": "Initial"
            }
          ],
          "ServerGroupId": "vsp-bp1qjwo61pqz3ahltv****",
          "ActionType": "TrafficMirror"
        }
      ]
    }
  ],
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
  "RuleHealthStatus": [
    {
      "RuleId": "rule-hp34s2h0xx1ht4nwo****",
      "ServerGroupInfos": [
        {
          "HealthCheckEnabled": "on",
          "NonNormalServers": [
            {
              "Port": 90,
              "Reason": {
                "ActualResponse": "302",
                "ExpectedResponse": "HTTP_2xx",
                "ReasonCode": "RESPONSE_MISMATCH"
              },
              "ServerId": "rg-bp1bfa08ex****",
              "ServerIp": "192.168.2.11",
              "Status": "Initial"
            }
          ],
          "ServerGroupId": "vsp-bp1qjwo61pqz3ahlt****",
          "ActionType": "TrafficMirror"
        }
      ]
    }
  ],
  "NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****"
}

Error codes

HTTP status codeError codeError messageDescription
403Forbidden.LoadBalancerAuthentication is failed for %s.Authentication is failed for %s.
404ResourceNotFound.LoadBalancerThe specified resource %s is not found.The specified resource %s is not found.
404ResourceNotFound.ListenerThe specified resource %s is not found.The specified resource %s is not found.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-29The Error code has changedView Change Details