This topic describes how to view the metrics and detailed monitoring data of a Server Load Balancer (SLB) instance by using the CloudMonitor SDKs for Java and Python.

Prerequisites

Note that SLB is the product label that has been configured in CloudMonitor.

Background information

The following figure shows how to call the API operation in the SDK to view monitoring data.

Procedure

The procedure is as follows:

  1. You can call the DescribeProjectMeta operation to query the namespace of SLB in CloudMonitor.
  2. You can call the DescribeMetricMetaList operation to query the descriptions of time series metrics provided by CloudMonitor for SLB.
  3. View monitoring metrics.
    • You can call the DescribeMetricLast operation to query the up-to-date monitoring data of a specified metric for SLB.
    • You can call the DescribeMetricList operation to query the monitoring data of time series metrics for SLB within a specified time period.

Python

This topic takes the QPS metric as an example. The SLB instance ID is lb-f8zbff0i07sv4qr1****, and a Layer-7 listener has been configured.

The sample code for querying the QPS metric through the SDK for Python is as follows:

from aliyunsdkcms.request.v20190101 import DescribeProjectMetaRequest, DescribeMetricMetaListRequest, \
    DescribeMetricLastRequest, DescribeMetricListRequest
from aliyunsdkcore.client import AcsClient
import json

if __name__ == '__main__':
    #1. Initialize the SDK
    ACS_CLIENT = AcsClient(
        'LTAI4FicM86BTPDyP******',  # your-access-key-id
        'VRj7d6LOl2ZyFyfYTWYzGk0*****',  # your-access-key-secret
        'cn-heyuan',  # your-region-id
    )

    # Product labels. Specify the SLB label to query SLB monitoring data.
    labels = "[{\"name\":\"product\",\"value\":\"SLB\"}]"
    # Monitoring dimensions. In this example, query the monitoring data of the backend server.
    dimensions = "[{\"instanceId\":\"lb-f8zbff0i07sv4qr1******\"}]"
    # Specify a time range as needed
    startTime = "2020-04-08 11:39:30"
    endTime = "2020-04-08 11:50:30"
    # The interval at which the monitoring data is collected
    period = "60"

    # 2. You can call the DescribeProjectMeta operation to query the SLB namespace
    describeProjectMetaRequest = DescribeProjectMetaRequest.DescribeProjectMetaRequest()
    describeProjectMetaRequest.set_Labels(labels)
    describeProjectMetaResponse = ACS_CLIENT.do_action_with_exception(describeProjectMetaRequest)
    describeProjectMetaResponse_json = json.loads(describeProjectMetaResponse)
    namespace = describeProjectMetaResponse_json['Resources']['Resource'][0]['Namespace']
    print("SLB Namespace: ", namespace)

    # 3. You can call the DescribeMetricMetaList operation to query the time series metrics available for SLB in CloudMonitor
    describeMetricMetaListRequest = DescribeMetricMetaListRequest.DescribeMetricMetaListRequest()
    describeMetricMetaListRequest.set_Namespace(namespace)
    describeMetricMetaListRequest.set_PageSize(100)
    describeMetricMetaListResponse = ACS_CLIENT.do_action_with_exception(describeMetricMetaListRequest)
    describeMetricMetaListResponse_json = json.loads(describeMetricMetaListResponse)
    metricMetaListResources = describeMetricMetaListResponse_json['Resources']['Resource']
    print(metricMetaListResources)

    # For example, query the ActiveConnection metric (number of active connections on the port)
    metricName = "Qps"  # Set the monitoring metric

    # 4. You can query the up-to-date monitoring data of a specified monitoring metric
    describeMetricLastRequest = DescribeMetricLastRequest.DescribeMetricLastRequest()
    describeMetricLastRequest.set_Namespace(namespace)
    describeMetricLastRequest.set_MetricName(metricName)
    describeMetricLastRequest.set_Dimensions(dimensions)
    describeMetricLastRequest.set_Period(period)
    describeMetricLastResponse = ACS_CLIENT.do_action_with_exception(describeMetricLastRequest)
    describeMetricLastResponse_json = json.loads(describeMetricLastResponse)
    print("The up-to-date monitoring data: \n", describeMetricLastResponse_json['Datapoints'])

    # 5. You can query data of a specified metric within a specified time period
    describeMetricListRequest = DescribeMetricListRequest.DescribeMetricListRequest()
    describeMetricListRequest.set_Namespace(namespace)
    describeMetricListRequest.set_MetricName(metricName)
    describeMetricListRequest.set_Dimensions(dimensions)
    describeMetricListRequest.set_Period(period)
    describeMetricListRequest.set_StartTime(startTime)
    describeMetricListRequest.set_EndTime(endTime)
    describeMetricListResponse = ACS_CLIENT.do_action_with_exception(describeMetricListRequest)
    print(describeMetricListResponse)
    describeMetricListResponse_json = json.loads(describeMetricListResponse)
    print(describeMetricListResponse_json)
    print("Monitoring data within the specified time period: \n", describeMetricListResponse_json['Datapoints'])
			

Java

This topic takes the QPS metric as an example. The SLB instance ID is lb-f8zbff0i07sv4qr1****, and a Layer-7 listener has been configured.

The sample code for querying the QPS metric through the SDK for Java is as follows:

package com.aliyun.cms;
import com.aliyun.CommonConfig;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.cms.model.v20190101.*;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.Gson;

import java.util.List;

public class DescribeSLBMonitorData {

    public static void main(String[] args) {
        // 1. Initialize the SDK
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou", // The ID of the region
                CommonConfig.ACCESSKEY_ID,// Your AccessKey ID
                CommonConfig.ACCESSKEY_SECRET);// Your AccessKey secret
        IAcsClient client = new DefaultAcsClient(profile);

        Gson gson = new Gson();
        // Product labels. Specify the SLB label to query SLB monitoring data.
        String labels = "[{\"name\":\"product\",\"value\":\"SLB\"}]";
        // Monitoring dimensions. In this example, query the monitoring data of the SLB instance.
        String dimensions = "[{\"instanceId\":\"lb-f8zbff0i07sv4qr1******\"}]";
        // Specify a time range as needed
        String startTime = "2020-04-08 11:39:30";
        String endTime = "2020-04-08 11:50:30";
        // The interval at which the monitoring data is collected
        String period = "60";
        DescribeSLBMonitorData describeSLBMonitorData = new DescribeSLBMonitorData();

        // 2. You can call the DescribeProjectMeta operation to query the SLB namespace
        DescribeProjectMetaRequest describeProjectMetaRequest = new DescribeProjectMetaRequest();
        describeProjectMetaRequest.setLabels(labels);
        DescribeProjectMetaResponse describeProjectMetaResponse = describeSLBMonitorData.describeProjectMeta(describeProjectMetaRequest, client);
        DescribeProjectMetaResponse.Resource projectMetaResource = describeProjectMetaResponse.getResources().get(0);
        String namespace = projectMetaResource.getNamespace();
        System.out.printf("SLB Namespace: %s\n", namespace);

        // 3. You can call the DescribeMetricMetaList operation to query the time series metrics available for SLB in CloudMonitor
        DescribeMetricMetaListRequest describeMetricMetaListRequest = new DescribeMetricMetaListRequest();
        describeMetricMetaListRequest.setNamespace(namespace);
        describeMetricMetaListRequest.setPageSize(100);
        DescribeMetricMetaListResponse describeMetricMetaListResponse = describeSLBMonitorData.describeMetricMetaList(describeMetricMetaListRequest, client);
        List<DescribeMetricMetaListResponse.Resource> metricMetaListResources = describeMetricMetaListResponse.getResources();
        System.out.println(gson.toJson(metricMetaListResources));

        // For example, query the ActiveConnection metric (number of active connections on a port)
        String metricName = "Qps";  // Set the monitoring metric

        // 4. You can query the up-to-date monitoring data of a specified monitoring metric
        DescribeMetricLastRequest describeMetricLastRequest = new DescribeMetricLastRequest();
        describeMetricLastRequest.setNamespace(namespace);
        describeMetricLastRequest.setMetricName(metricName);
        describeMetricLastRequest.setDimensions(dimensions);
        describeMetricLastRequest.setPeriod(period);
        DescribeMetricLastResponse describeMetricLastResponse = describeSLBMonitorData.describeMetricLast(describeMetricLastRequest, client);
        System.out.printf("The up-to-date monitoring data: \n%s", describeMetricLastResponse.getDatapoints());

        // 5. You can query data of a specified metric within a specified time period
        DescribeMetricListRequest describeMetricListRequest = new DescribeMetricListRequest();
        describeMetricListRequest.setNamespace(namespace);
        describeMetricListRequest.setMetricName(metricName);
        describeMetricListRequest.setDimensions(dimensions);
        describeMetricListRequest.setPeriod(period);
        describeMetricListRequest.setStartTime(startTime);
        describeMetricListRequest.setEndTime(endTime);
        DescribeMetricListResponse describeMetricListResponse = describeSLBMonitorData.describeMetricList(describeMetricListRequest, client);
        System.out.printf("\n Monitoring data within the specified time period: \n%s", describeMetricListResponse.getDatapoints());
    }

    /**
     * You can retrieve information about the connected cloud services, including descriptions, namespaces, and labels.
     */
    private DescribeProjectMetaResponse describeProjectMeta(DescribeProjectMetaRequest request, IAcsClient client) {
        try {
            // Send a request by calling the SDK
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // If an error occurs while calling the SDK, a runtime error is returned
            throw new RuntimeException();
        }
    }

    /**
     * Query up-to-date monitoring data of a specified monitoring metric
     */
    private DescribeMetricLastResponse describeMetricLast(DescribeMetricLastRequest request, IAcsClient client) {
        try {
            // Send a request by calling an SDK
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // If an error occurs while calling the SDK, a runtime error is returned
            throw new RuntimeException();
        }
    }

    /**
     * Query the time series metrics supported by CloudMonitor
     */
    private DescribeMetricMetaListResponse describeMetricMetaList(DescribeMetricMetaListRequest request, IAcsClient client) {
        try {
            // Send a request by calling the SDK
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // If an error occurs while calling the SDK, a runtime error is returned
            throw new RuntimeException();
        }
    }

    /**
     * Query the monitoring data of time series metrics of cloud services within a specified time period
     */
    private DescribeMetricListResponse describeMetricList(DescribeMetricListRequest request, IAcsClient client) {
        try {
            // Send a request by calling the SDK
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // If an error occurs while calling the SDK, a runtime error is returned
            throw new RuntimeException();
        }
    }

}

Responses

The returned parameters are as follows:

SLB  Namespace:    acs_slb_dashboard     
[{'MetricName':  'ActiveConnection',  'Periods':  '60,300',  'Description':  'Number of active connections on the port',  'Dimensions':  'userId,instanceId,port,protocol',  'Labels':  '[{"name":"alertUnit","value":"Count"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]',  'Unit':  'Count',  'Statistics':  'Average,Minimum,Maximum',  'Namespace':  'acs_slb_dashboard'},  {'MetricName':  'DropConnection',  'Periods':  '60,300',  'Description':  '',  'Dimensions':  'userId,instanceId,port,protocol',  'Labels':  '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]',  'Unit':  'Count/s',  'Statistics':  'Average,Minimum,Maximum',  'Namespace':  'acs_slb_dashboard'},  {'MetricName':  'DropPacketRX',  'Periods':  '60,300',  'Description':  '',  'Dimensions':  'userId,instanceId,port,protocol',  'Labels':  '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]',  'Unit':  'Count/s',  'Statistics':  'Average,Minimum,Maximum',  'Namespace':  'acs_slb_dashboard'},  {'MetricName':  'DropPacketTX',  'Periods':  '60,300',  'Description':  '',  'Dimensions':  'userId,instanceId,port,protocol',  'Labels':  '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]',  'Unit':  'Count/s',  'Statistics':  'Average,Minimum,Maximum',  'Namespace':  'acs_slb_dashboard'},  {'MetricName':  'DropTrafficRX',  'Periods':  '60,300',  'Description':  '',  'Dimensions':  'userId,instanceId,port,protocol',  'Labels':  '[{"name":"alertUnit","value":"bits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]',  'Unit':  'bits/s',  'Statistics':  'Average,Minimum,Maximum',  'Namespace':  'acs_slb_dashboard'},  {'MetricName':  'DropTrafficTX',  'Periods':  '60,300',  'Description':  '',  'Dimensions':  'userId,instanceId,port,protocol',  'Labels':  '[{"name":"alertUnit","value":"bits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]',  'Unit':  'bits/s',  'Statistics':  'Average,Minimum,Maximum',  'Namespace':  'acs_slb_dashboard'},  {'MetricName':  'GroupTrafficRX',  'Periods':  '60',  'Description':  '',  'Dimensions':  'groupId',  'Labels':  '[{"name":"alertUnit","value":"bits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"groupId"},{"name":"is_alarm","value":"true"}]',  'Unit':  'bits/s',  'Statistics':  'Average,Minimum,Maximum,Sum',  'Namespace':  'acs_slb_dashboard'},  {'MetricName':  'GroupTrafficTX',  'Periods':  '60',  'Description':  '',  'Dimensions':  'groupId',  'Labels':  '[{"name":"alertUnit","value":"bits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"groupId"},{"name":"is_alarm","value":"true"}]',  'Unit':  'bits/s', 'Statistics': 'Average,Minimum,Maximum,Sum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'HeathyServerCount', 'Periods': '60,300', 'Description': 'Number of healthy ECS instances', 'Dimensions': 'userId,instanceId,port,vip', 'Labels': '[{"name":"alertUnit","value":"Count"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InactiveConnection', 'Periods': '60,300', 'Description': 'Number of inactive connections on the port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceActiveConnection', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceDropConnection', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceDropPacketRX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceDropPacketTX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceDropTrafficRX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"bits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceDropTrafficTX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"bits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceInactiveConnection', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceMaxConnection', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceMaxConnectionUtilization', 'Periods': '60,300', 'Description': 'Maximum connection utilization', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"%"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': '%', 'Statistics': 'Average,Maximum,Minimum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceNewConnection', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceNewConnectionUtilization', 'Periods': '60,300', 'Description': 'Utilization of new connections', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"%"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': '%', 'Statistics': 'Average,Maximum,Minimum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstancePacketRX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstancePacketTX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceQps', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceQpsUtilization', 'Periods': '60,300', 'Description': 'QPS utilization', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"%"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': '%', 'Statistics': 'Average,Maximum,Minimum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceRt', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"ms"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'ms', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceStatusCode2xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceStatusCode3xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceStatusCode4xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceStatusCode5xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceStatusCodeOther', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceTrafficRX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceTrafficTX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceUpstreamCode4xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceUpstreamCode5xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceUpstreamRt', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"ms"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'ms', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'MaxConnection', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Maximum,Minimum,Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'NewConnection', 'Periods': '60,300', 'Description': 'Number of new connections on the port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'PacketRX', 'Periods': '60,300', 'Description': 'The number of inbound packets received per second on a port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'PacketTX', 'Periods': '60,300', 'Description': 'The number of outbound packets sent per second on a port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'Qps', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'Rt', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"ms"},{"name":"alertDefault","value":"ms"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': '', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode2xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode3xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode4xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode5xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCodeOther', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'TrafficRXNew', 'Periods': '60,300', 'Description': 'The amount of data received per second on a port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'TrafficTXNew', 'Periods': '60,300', 'Description': 'The amount of data sent per second on a port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'UnhealthyServerCount', 'Periods': '60,300', 'Description': 'Number of ECS instances that have errors', 'Dimensions': 'userId,instanceId,port,vip', 'Labels': '[{"name":"alertUnit","value":"Count"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'UpstreamCode4xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'UpstreamCode5xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'UpstreamRt', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"ms"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'ms', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}]
The up-to-date monitoring data:
 [{"timestamp":1586318940000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0}]
b'{"RequestId":"16064EB5-909D-40E3-BB9B-AB287E801AB1","Period":"60","Datapoints":"[{\\"timestamp\\":1586317200000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr******\\",\\"port\\":\\"80\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317260000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"80\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317320000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"80\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317380000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"80\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317440000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"8090\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317500000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"8090\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317560000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"8090\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317620000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"8090\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317680000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"8090\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317740000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"8090\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0},{\\"timestamp\\":1586317800000,\\"userId\\":\\"18576685985*****\\",\\"instanceId\\":\\"lb-f8zbff0i07sv4qr1*****\\",\\"port\\":\\"8090\\",\\"protocol\\":\\"http\\",\\"vip\\":\\"47.115. **. **\\",\\"Average\\":0}]","Code":"200","Success":true}'
{'RequestId': '16064EB5-909D-40E3-BB9B-AB287E801AB1', 'Period': '60', 'Datapoints': '[{"timestamp":1586317200000,"userId":"1857668598503****","instanceId":"lb-f8zbff0i07sv4qr1******","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317260000,"userId":"185766859850****","instanceId":"lb-f8zbff0i07sv4qr1****","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317320000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317380000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317440000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317500000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317560000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317620000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317680000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317740000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317800000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0}]', 'Code': '200', 'Success': True}
Monitoring data within the specified time period:
 [{"timestamp":1586317200000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1q****","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317260000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317320000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317380000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"80","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317440000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317500000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317560000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317620000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317680000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317740000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0},{"timestamp":1586317800000,"userId":"18576685985*****","instanceId":"lb-f8zbff0i07sv4qr1*****","port":"8090","protocol":"http","vip":"47.115. **. **","Average":0}]