结合阿里云云监控服务,您可以通过控制台、API接口和SDK来查看传统型负载均衡CLB的监控信息。

前提条件

请确保您已经创建了实例并添加了监听。具体操作,请参见:

通过控制台查看监控

  1. 登录传统型负载均衡CLB控制台
  2. 在顶部菜单栏,选择CLB实例所属的地域。
  3. 单击目标实例的监控图标图标。
  4. 选择要查看的监控指标,查看监控数据。
    监控指标 说明
    流量
    • 流入流量:从外部访问负载均衡所消耗的流量。
    • 流出流量:负载均衡访问外部所消耗的流量。
    数据包数
    • 流入数据包数:负载均衡每秒接到的请求数据包数量。
    • 流出数据包数:负载均衡每秒发出的数据包数量。
    并发连接数
    • 活跃连接数:所有ESTABLISHED状态的TCP连接。因为如果您采用的是长连接的情况,一个连接会同时传输多个文件请求。
    • 非活跃连接数:表示除ESTABLISHED状态的其它所有状态的TCP连接数。Windows和Linux服务器都可以使用netstat -an命令查看。
    • 最大并发连接数:所有建立的TCP连接数量。
    新建连接数 在统计周期内,新建立的从客户端连接到负载均衡的连接请求的平均数。
    丢弃流量
    • 丢弃入流量:每秒丢失的入流量。
    • 丢弃出流量:每秒丢失的出流量。
    丢弃数据包数
    • 丢弃流入数据包:每秒丢弃的流入数据包的数量。
    • 丢弃流出数据包:每秒丢弃的流出数据包的数量。
    丢弃连接数 每秒丢弃的连接数。
    以下是7层(HTTP/HTTPS)监听特有的监控指标。
    7层协议QPS 每秒可以处理的HTTP/HTTPS请求。
    7层协议RT 负载均衡的平均响应时间。
    7层协议2XX/3XX/4XX/5XX/其他状态码 监听返回的HTTP响应代码的数量。
    7层协议UpstreamCode4XX/5XX 后端服务器返回的HTTP响应代码的数量。
    7层协议UpstreamRT 后端服务器的平均响应时间。

通过API查看监控

通过云监控API可以查看CLB实例的监控项和详细监控数据。

monitoring
通过API查看监控数据的流程如下:
  1. 查看数据命名空间Namespace。调用DescribeProjectMeta接口查询云监控中CLB的数据命名空间Namespace。
  2. 可选:查看已有监控项。调用DescribeMetricMetaList接口查询云监控开放的时序类指标监控项描述或直接查看监控项说明,更多信息,请参见监控报警项说明
  3. 查看指定监控项的监控数据。
    • 调用DescribeMetricLast接口查询CLB指定监控对象的最新监控数据。
    • 调用DescribeMetricList接口查询CLB指定时间段内监控对象的时序指标监控数据。

DescribeProjectMeta

调用DescribeProjectMeta接口查询云监控中CLB的数据命名空间Namespace。

  1. 登录登录OpenAPI开发者门户
  2. 将请求参数中报警产品标签过滤Labels的值设置为[{"name":"product","value":"SLB"}],其他参数保持默认值。
    请求示例:
    http(s)://[Endpoint]/?Action=DescribeProjectMeta
    &Labels=[{"name":"product","value":"SLB"}]
    &<公共请求参数>
  3. 根据返回参数,获取云监控中负载均衡数据命名空间Namespace的值为acs_slb_dashboard
    返回示例:
    {
        "PageSize": 30, 
        "RequestId": "75B895A2-62A4-411E-871C-0EED97CC0D26", 
        "PageNumber": 1, 
        "Total": 1, 
        "Resources": {
            "Resource": [
                {
                    "Description": "负载均衡", 
                    "Labels": "[{\"name\":\"product\",\"value\":\"SLB\"},{\"name\":\"productCategory\",\"value\":\"slb\"},{\"name\":\"groupFlag\",\"value\":\"true\"},{\"name\":\"cnName\",\"value\":\"负载均衡\"},{\"name\":\"enName\",\"value\":\"Server Load Balancer\"}]", 
                    "Namespace": "acs_slb_dashboard"
                }
            ]
        }, 
        "Code": 200, 
        "Success": true
    }

DescribeMetricMetaList

调用DescribeMetricMetaList接口查询云监控开放的时序类指标监控项描述。

  1. 登录登录OpenAPI开发者门户
  2. 将请求参数中数据命名空间Namespace的值设置为acs_slb_dashboard,其他参数保持默认值。
    请求示例:
    http(s)://[Endpoint]/?Action=DescribeMetricMetaList
    &Namespace=acs_slb_dashboard
    &<公共请求参数>
  3. 根据返回参数,查看负载均衡的时序类指标监控项。可以查看本次示例中使用的监控项QPS是否存在。
    返回示例:
    {
        "TotalCount": 53, 
        "RequestId": "789846B4-56FC-4681-998C-5B7DBDFBE28F", 
        "Resources": {
            "Resource": [
                {
                    "MetricName": "ActiveConnection", 
                    "Periods": "60,300", 
                    "Description": "端口当前活跃连接数", 
                    "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": "当前后端健康ECS实例个数", 
                    "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": "端口当前非活跃连接数", 
                    "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": "最大连接数使用率", 
                    "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": "新建连接数使用率", 
                    "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使用率", 
                    "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"
                }
            ]
        }, 
        "Code": 200, 
        "Success": true
    }

DescribeMetricLast

调用DescribeMetricLast接口查询负载均衡指定监控对象的最新监控数据,本示例查看七层协议QPS的最新监控数据。

  1. 登录登录OpenAPI开发者门户
  2. 在请求参数中,设置查询QPS的参数。
    需要配置以下参数,其他参数可保持默认值。
    • MetricName:监控项名称,本示例设置为QPS
    • Dimensions:维度map,用于查询指定资源的监控数据,本示例设置为[{"instanceId":"lb-bp1r92vzpemy099f******"}]
    • Namespace:产品的数据命名空间,用于区分不同的产品,本示例设置为acs_slb_dashboard

    请求示例:

    http(s)://[Endpoint]/?Action=DescribeMetricLast
    &MetricName=Qps
    &Namespace=acs_slb_dashboard
    &Dimensions=[{"instanceId":"lb-bp1r92vzpemy099f******"}]
    &<公共请求参数>
  3. 根据返回参数,查看QPS的最新监控数据。
    返回示例:
    {
        "RequestId": "B0EED5A2-7FE2-4A0C-B5E9-3D961F86DC9D", 
        "Period": "60", 
        "Datapoints": "[{\"timestamp\":1586248680000,\"userId\":\"16884015959*****\",\"instanceId\":\"lb-bp1r92vzpemy099f*****\",\"port\":\"80\",\"protocol\":\"http\",\"vip\":\"121.43.**.**\",\"Average\":0}]", 
        "Code": "200", 
        "Success": true
    }

DescribeMetricList

调用DescribeMetricList接口查询负载均衡指定时间段内的时序指标监控数据。

  1. 登录OpenAPI开发者门户
  2. 在请求参数中,设置查询指定时间内QPS的监控数据。
    需要配置以下参数,其他参数可保持默认值。
    • MetricName:监控项名称,本次示例设置为QPS
    • Namespace:产品的数据命名空间,用于区分不同的产品,本次示例设置为acs_slb_dashboard
    • Dimensions:维度map,用于查询指定资源的监控数据,本示例设置为[{"instanceId":"lb-bp1r92vzpemy099f******"}]
    • StartTime:开始时间,StartTime不能等于或大于EndTime,本次示例设置为2020-03-28 00:10:00

      支持格式:

      • Unix时间戳:从1970年1月1日开始所经过的秒数。
      • Format格式:YYYY-MM-DDThh:mm:ssZ。
    • EndTime:结束时间,支持的格式和StartTime一致,本次示例设置为2020-03-28 00:11:00

    请求示例:

    http(s)://[Endpoint]/?Action=DescribeMetricList
    &MetricName=Qps
    &Namespace=acs_slb_dashboard
    &Dimensions=[{"instanceId":"lb-bp1r92vzpemy099f******"}]
    &StartTime=2020-03-28 00:10:00
    &EndTime=2020-03-28 00:11:00
    &<公共请求参数>
  3. 根据返回参数,查看QPS在指定时间内的监控数据。
    返回示例:
    {
        "RequestId": "DFF0A853-0E37-4108-A9AF-5B3D609BD489", 
        "Period": "60", 
        "Datapoints": "[{\"timestamp\":1585325460000,\"userId\":\"168840159596****\",\"instanceId\":\"lb-bp1r92vzpemy099f******\",\"port\":\"80\",\"protocol\":\"http\",\"vip\":\"121.43.**.**\",\"Average\":0}]", 
        "Code": "200", 
        "Success": true
    }

通过SDK查看监控

通过云监控Java和Python SDK可以查看CLB实例的监控项和详细监控数据。

monitoring

Python示例

以查询实例ID为lb-f8zbff0i07sv4qr1****,配置了七层监听的CLB实例的QPS监控项为例,Python SDK代码如下所示:

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

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

    # 过滤标签,此处过滤产品名称为SLB的数据
    labels = "[{\"name\":\"product\",\"value\":\"SLB\"}]"
    # 监控维度,此处查询后端服务器实例的监控数据
    dimensions = "[{\"instanceId\":\"lb-f8zbff0i07sv4qr1******\"}]"
    # 指定查询时间段,根据需要自行替换
    startTime = "2022-09-23 11:39:30"
    endTime = "2020-09-23 11:50:30"
    # 监控数据时间间隔
    period = "60"

    # 2.调用DescribeProjectMeta接口查询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.调用DescribeMetricMetaList接口查询SLB可用的云监控时序类指标监控项
    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)

    # 这里以查询此监控项为例:ActiveConnection(端口当前活跃连接数)
    metricName = "Qps"  #设置监控项

    # 4.查询指定监控项的最新监控数据
    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("最新监控数据:\n", describeMetricLastResponse_json['Datapoints'])

    # 5.查询指定时间段内的指定监控项数据
    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("指定时间段的监控数据:\n", describeMetricListResponse_json['Datapoints'])
            

Java示例

以查询实例ID为lb-f8zbff0i07sv4qr1****,配置了七层监听的负载均衡实例的QPS监控项为例,Java代码如下所示:

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.初始化SDK
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou",// 地域ID
                CommonConfig.ACCESSKEY_ID,// 您的AccessKey ID
                CommonConfig.ACCESSKEY_SECRET);// 您的AccessKey Secret
        IAcsClient client = new DefaultAcsClient(profile);

        Gson gson = new Gson();
        // 过滤标签,此处过滤产品名称为SLB的数据
        String labels = "[{\"name\":\"product\",\"value\":\"SLB\"}]";
        // 监控维度,此处查询SLB实例的监控数据
        String dimensions = "[{\"instanceId\":\"lb-f8zbff0i07sv4qr1******\"}]";
        // 指定查询时间段,根据需要自行替换
        String startTime = "2020-04-08 11:39:30";
        String endTime = "2020-04-08 11:50:30";
        // 监控数据时间间隔
        String period = "60";
        DescribeSLBMonitorData describeSLBMonitorData = new DescribeSLBMonitorData();

        // 2.调用DescribeProjectMeta接口查询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.调用DescribeMetricMetaList接口查询SLB可用的云监控时序类指标监控项
        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));

        // 这里以查询此监控项为例:ActiveConnection(端口当前活跃连接数)
        String metricName = "Qps";  //设置监控项

        // 4.查询指定监控项的最新监控数据
        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("最新监控数据:\n%s", describeMetricLastResponse.getDatapoints());

        // 5.查询指定时间段内的指定监控项数据
        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指定时间段的监控数据:\n%s", describeMetricListResponse.getDatapoints());
    }

    /**
     * 获取接入的云产品信息,包括产品的描述信息、 Namespace和标签
     */
    private DescribeProjectMetaResponse describeProjectMeta(DescribeProjectMetaRequest request, IAcsClient client) {
        try {
            // 调用SDK发送请求
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // 发生调用错误,抛出运行时异常
            throw new RuntimeException();
        }
    }

    /**
     * 查询指定监控对象的最新监控数据
     */
    private DescribeMetricLastResponse describeMetricLast(DescribeMetricLastRequest request, IAcsClient client) {
        try {
            // 调用SDK发送请求
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // 发生调用错误,抛出运行时异常
            throw new RuntimeException();
        }
    }

    /**
     * 查询云监控开放的时序类指标
     */
    private DescribeMetricMetaListResponse describeMetricMetaList(DescribeMetricMetaListRequest request, IAcsClient client) {
        try {
            // 调用SDK发送请求
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // 发生调用错误,抛出运行时异常
            throw new RuntimeException();
        }
    }

    /**
     * 查询指定时间段内的云产品时序指标监控数据
     */
    private DescribeMetricListResponse describeMetricList(DescribeMetricListRequest request, IAcsClient client) {
        try {
            // 调用SDK发送请求
            return client.getAcsResponse(request);
        } catch (ClientException e) {
            e.printStackTrace();
            // 发生调用错误,抛出运行时异常
            throw new RuntimeException();
        }
    }

}

SDK返回结果

SDK返回结果如下:

SLB  Namespace:    acs_slb_dashboard     
[{'MetricName':  'ActiveConnection',  'Periods':  '60,300',  'Description':  '端口当前活跃连接数',  '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': '当前后端健康ECS实例个数', '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': '端口当前非活跃连接数', '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': '最大连接数使用率', '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': '新建连接数使用率', '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使用率', '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': '端口当前新建连接数', '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': '端口每秒流入数据包数', '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': '端口每秒流出数据包数', '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': '端口每秒流入数据量', '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': '端口每秒流出数据量', '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': '当前后端异常ECS实例个数', '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'}]
最新监控数据:
 [{"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}
指定时间段的监控数据:
 [{"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}]

相关文档