After you activate the CloudMonitor service, you can use the CloudMonitor console, APIs, and SDKs to configure alert rules for Classic Load Balancer (CLB) instances.

Background information

If a listener or a Classic Load Balancer (CLB) instance is deleted, its alert rules are also deleted.

Prerequisites

Configure alert rules in the CloudMonitor console

  1. Log on to the CLB console.
  2. In the top navigation bar, select the region where the CLB instance is deployed.
  3. On the Instances page, find the CLB instance that you want to manage and click in the Monitoring column.
  4. On the Monitoring Data panel, click Threshold Alerting Settings.
  5. On the Alert Rules page of the CloudMonitor console, click Create Alert Rule.
  6. In the Create Alert Rule panel, configure alert rules. For more information, see Create an alert rule.

Configure alert rules by calling the Cloud Monitor APIs

The following figure shows the procedure to configure alert rules by calling Cloud Monitor APIs. Procedure to configure alert rules by calling Cloud Monitor API operations
  1. Optional:Call the DescribeMetricMetaList operation to query the descriptions of SLB time series metrics that are supported in Cloud Monitor, or directly view the descriptions of the metrics in the console. For more information, see Monitoring and alerting metrics.
  2. Call the PutContact operation to create or modify an alert contact.
  3. Call the PutContactGroup operation to create or modify an alert contact group.
  4. Call the PutResourceMetricRule operation to configure a threshold-triggered alert rule for a performance metric of a resource.
  5. Call the DescribeMetricRuleList operation to query alert rules.

For example, assume that a TCP listener has been configured for the lb-bp1rbwvouuyipbc*** instance. The following section describes how to set rules to trigger Critical, Warn, and Info alerts when the number of unhealthy ECS instances exceeds the specified thresholds.

DescribeMetricMetaList

Call the DescribeMetricMetaList operation to query the descriptions of time series metrics supported in Cloud Monitor.

  1. Set the value of the data namespace Namespace in the request parameters to acs_slb_dashboard. Keep the default values for other parameters.
    Sample requests:
    http(s)://[Endpoint]/?Action=DescribeMetricMetaList
    &Namespace=acs_slb_dashboard
    &<Common request parameters>
  2. View the time series metrics of SLB based on the returned parameters. Check whether the Qps parameter is returned in this example.
    Sample success response:
    {
        "TotalCount": 53, 
        "RequestId": "789846B4-56FC-4681-998C-5B7DBDFBE28F", 
        "Resources": {
            "Resource": [
                {
                    "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 usage", 
                    "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": "New connection usage", 
                    "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 usage", 
                    "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
    }

PutContact

Call the PutContact operation to create an alert contact. If an alert contact already exists, you can call this operation to change the alert contact.

  1. Set the name and contact information of the alert contact In the request parameters.
    In this example, configure the following parameters and keep the default values for other parameters.
    • ContactName: the name of the alert contact.
    • Channels.Mail: the email address of the alert contact. After you add or modify an email address, the recipient receives an email that contains an activation link. The system adds the recipient to the list of alert contacts only after the recipient activates the email address.

    Sample requests:

    http(s)://[Endpoint]/?Action=PutContact
    &ContactName=doctest
    &Channels.Mail=u****e@example.com
    &<Common request parameters>
  2. Check whether the alert contact is created based on the returned parameters.
    Sample success response:
    {
        "RequestId": "50E26BC3-B211-4713-9608-EE8CE2EAB7E1", 
        "Code": "200", 
        "Success": true
    }

PutContactGroup

Call the PutContactGroup operation to create an alert contact group. If an alert contact group already exists, you can call this operation to modify the alert contact group.

  1. Set the name and description of an alert contact group, and the names of the alert contacts in the group in the request parameters.
    In this example, configure the following parameters and keep the default values for other parameters.
    • ContactGroupName: the name of the alert contact group.
    • Describe: the description of the alert contact group.
    • ContactNames: the names of the alert contacts in the group.

    Sample requests:

    http(s)://[Endpoint]/?Action=PutContactGroup
    &ContactGroupName=doctestgroup
    &ContactNames.1=doctest
    &Describe=SLB alert contact group
    &<Common request parameters>
  2. Check whether the alert contact group is created based on the returned parameters.
    Sample success response:
    {
        "RequestId": "B8B88837-99A4-4F0D-B445-5E9C072D154D", 
        "Code": "200", 
        "Success": true
    }

PutResourceMetricRule

Calls the PutResourceMetricRule operation to configure a threshold-triggerd alert rule for a performance metric of a resource.

  1. Set the alert threshold for the number of unhealthy ECS instances in the request parameters.
    In this example, configure the following parameters and keep the default values for other parameters.
    Parameter Description
    RuleId The ID of the alert rule.
    Namespace The namespace of SLB. Set the value to acs_slb_dashboard.
    MetricName The names of metrics. You can query the result according to DescribeMetricRuleList or set the parameter according to Monitoring and alerting metrics.

    In this example, the metric that indicates the number of unhealthy ECS instances is UnhealthyServerCount.

    Resources The resource for which the alert rule is applied. If you want to associate SLB instances with the alert rule, specify the instances in the [{"instanceId":"lb-bp1rbwvouu******"}] format.
    ContactGroups The alert contact group. Separate multiple groups with commas (,).
    Escalations.Critical.Statistics The statistical method for the Critical-level alert. Valid values:
    • Average
    • Minimum
    • Maximum
    Escalations.Critical.ComparisonOperator The operator that is used to compare the metric value with the threshold. Valid values:
    • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.
    • GreaterThanThreshold: greater than the threshold.
    • LessThanOrEqualToThreshold: less than or equal to the threshold.
    • LessThanThreshold: less than the threshold.
    • NotEqualToThreshold: not equal to the threshold.
    • GreaterThanYesterday: greater than the metric value at the same time yesterday.
    • LessThanYesterday: less than the metric value at the same time yesterday.
    • GreaterThanLastWeek: greater than the metric value at the same time last week.
    • LessThanLastWeek: less than the metric value at the same time last week.
    • GreaterThanLastPeriod: greater than the metric value in the last monitoring cycle.
    • LessThanLastPeriod: less than the metric value in the last monitoring cycle.
    Escalations.Critical.Threshold The threshold for Critical-level alerts.
    Escalations.Critical.Times The consecutive number of times for which the metric value meets the trigger condition before a Critical-level alert is triggered.
    Escalations.Warn.Statistics The statistical methods for Warn-level alerts. Valid values:
    • Average
    • Minimum
    • Maximum
    Escalations.Warn.ComparisonOperator The operator that is used to compare the metric value with the threshold. Valid values:
    • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.
    • GreaterThanThreshold: greater than the threshold.
    • LessThanOrEqualToThreshold: less than or equal to the threshold.
    • LessThanThreshold: less than the threshold.
    • NotEqualToThreshold: not equal to the threshold.
    • GreaterThanYesterday: greater than the metric value at the same time yesterday.
    • LessThanYesterday: less than the metric value at the same time yesterday.
    • GreaterThanLastWeek: greater than the metric value at the same time last week.
    • LessThanLastWeek: less than the metric value at the same time last week.
    • GreaterThanLastPeriod: greater than the metric value in the last monitoring cycle.
    • LessThanLastPeriod: less than the metric value in the last monitoring cycle.
    Escalations.Warn.Threshold The threshold for Warn-level alerts.
    Escalations.Warn.Times The consecutive number of times for which the metric value meets the trigger condition before a Warn-level alert is triggered.
    Escalations.Info.Statistics The statistical methods for Info-level alerts. Valid values:
    • Average
    • Minimum
    • Maximum
    Escalations.Info.ComparisonOperator The operator that is used to compare the metric value with the threshold. Valid values:
    • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.
    • GreaterThanThreshold: greater than the threshold.
    • LessThanOrEqualToThreshold: less than or equal to the threshold.
    • LessThanThreshold: less than the threshold.
    • NotEqualToThreshold: not equal to the threshold.
    • GreaterThanYesterday: greater than the metric value at the same time yesterday.
    • LessThanYesterday: less than the metric value at the same time yesterday.
    • GreaterThanLastWeek: greater than the metric value at the same time last week.
    • LessThanLastWeek: less than the metric value at the same time last week.
    • GreaterThanLastPeriod: greater than the metric value in the last monitoring cycle.
    • LessThanLastPeriod: less than the metric value in the last monitoring cycle.
    Escalations.Info.Threshold The threshold for Info-level alerts.
    Escalations.Info.Times The consecutive number of times for which the metric value meets the trigger condition before an Info-level alert is triggered.

    Sample requests:

    http(s)://[Endpoint]/?Action=PutResourceMetricRule
    &ContactGroups=doctestgroup
    &MetricName=UnhealthyServerCount
    &Namespace=acs_slb_dashboard
    &Resources=[{"instanceId":"lb-bp1rbwvouuyipbc*****}]
    &Escalations.Critical.Statistics=Minimum
    &Escalations.Critical.ComparisonOperator=GreaterThanOrEqualToThreshold
    &Escalations.Critical.Threshold=100
    &Escalations.Warn.Statistics=Average
    &Escalations.Warn.ComparisonOperator=GreaterThanOrEqualToThreshold
    &Escalations.Warn.Threshold=30
    &Escalations.Info.Statistics=Maximum
    &Escalations.Info.ComparisonOperator=30
    &Escalations.Info.Threshold=30
    &<Common request parameters>
  2. Check whether the alert rule is created based on the returned Success value.
    Sample success response:
    {
        "Message":"",
        "RequestId":"C65B0B84-DDE8-4DCA-8663-5836773102D4",
        "Success":true,
        "Code":"200"
    }

DescribeMetricRuleList

Call the DescribeMetricRuleList operation to query the alert rules.

  1. Set the SLB namespace and alert metrics to query detailed information about the alert metrics in the request parameters.
    In this example, configure the following parameters and keep the default values for other parameters.
    • Namespace: Set the namespace of SLB to acs_slb_dashboard.
    • MetricName: Specify the alert metrics to be queried.
    Request parameters
    http(s)://[Endpoint]/?Action=DescribeMetricRuleList
    &Namespace=acs_slb_dashboard
    &MetricName=UnhealthyServerCount
    &<Common request parameters>
  2. View the details of the alert metrics specified in this example based on the returned parameters.
    Sample success response:
    {
        "RequestId": "F249E314-1763-4662-A347-BD54C739191E", 
        "Total": 1, 
        "Alarms": {
            "Alarm": [
                {
                    "GroupName": "", 
                    "SilenceTime": 86400, 
                    "ContactGroups": "doctestgroup", 
                    "NoEffectiveInterval": "", 
                    "MailSubject": "${serviceType}-${metricName}-${levelDescription}Notification(${dimensions})", 
                    "RuleId": "123", 
                    "SourceType": "METRIC", 
                    "Period": 300, 
                    "Dimensions": "", 
                    "EffectiveInterval": "", 
                    "Namespace": "acs_slb_dashboard", 
                    "AlertState": "INSUFFICIENT_DATA", 
                    "GroupId": "", 
                    "MetricName": "UnhealthyServerCount", 
                    "EnableState": true, 
                    "Escalations": {
                        "Critical": { }, 
                        "Info": {
                            "ComparisonOperator": "LessThanThreshold", 
                            "Times": 3, 
                            "Statistics": "Average", 
                            "Threshold": "3"
                        }, 
                        "Warn": {
                            "ComparisonOperator": "GreaterThanThreshold", 
                            "Times": 3, 
                            "Statistics": "Average", 
                            "Threshold": "10"
                        }
                    }, 
                    "Webhook": "", 
                    "Resources": "[{\"instanceId\":\"lb-bp1rbwvouuyipbc*****\"}]", 
                    "RuleName": "UnhealthyServerCount"
                }
            ]
        }, 
        "Code": "200", 
        "Success": true
    }

Configure alert rules by using Cloud Monitor SDKs

The following figure shows the procedure to configure alert rules by calling Cloud Monitor SDKs. Procedure to configure alert rules by calling Cloud Monitor SDKs
  1. Optional:Call the DescribeMetricMetaList operation to query the descriptions of SLB time series metrics that are supported in Cloud Monitor. For more information, see Monitoring and alerting metrics.
  2. Call the PutContact operation to create or modify an alert contact.
  3. Call the PutContactGroup operation to create or modify an alert contact group.
  4. Call the PutResourceMetricRule operation to configure a threshold-triggered alert rule for a performance metric of a resource.
  5. Call the DescribeMetricRuleList operation to query alert rules.

Python examples

For example, assume that a TCP listener has been configured for the lb-bp13hithhod4aoxc***** instance. The following section describes how to configure rules to trigger Critical, Warn, and Info alerts when the number of unhealthy ECS instances exceeds the specified thresholds.

from aliyunsdkcms.request.v20190101 import DescribeMetricMetaListRequest, PutContactRequest, PutContactGroupRequest, \
    PutResourceMetricRuleRequest, DescribeMetricRuleListRequest
from aliyunsdkcore.client import AcsClient
import json, uuid

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

    # Specify the namespace
    namespace = "acs_slb_dashboard"

    # 2. Query the descriptions of time series metrics supported in Cloud Monitor
    describeMetricMetaListRequest = DescribeMetricMetaListRequest.DescribeMetricMetaListRequest()
    # Set the namespace
    describeMetricMetaListRequest.set_Namespace(namespace)
    # The number of records on each page. Default value: 30
    describeMetricMetaListRequest.set_PageSize(100)
    describeMetricMetaListResponse = ACS_CLIENT.do_action_with_exception(describeMetricMetaListRequest)
    print(json.loads(describeMetricMetaListResponse))

    #3. Create an alert contact
    putContactRequest = PutContactRequest.PutContactRequest()
    # The name of the alert contact
    putContactRequest.set_ContactName("doctest")
    # The description of the alert contact
    putContactRequest.set_Describe("doctest")
    # The email address of the alert contact
    putContactRequest.set_ChannelsMail("u****e@example.com")
    putContactResponse = ACS_CLIENT.do_action_with_exception(putContactRequest)
    print(json.loads(putContactResponse))

    #4. Create an alert contact group
    putContactGroupRequest = PutContactGroupRequest.PutContactGroupRequest()
    # The name of the alert contact group
    putContactGroupRequest.set_ContactGroupName("the default alert contact group")
    # The description of the alert contact group
    putContactGroupRequest.set_Describe("the default alert contact group")
    putContactGroupRequest.set_ContactNamess(["doctest"])
    putContactGroupResponse = ACS_CLIENT.do_action_with_exception(putContactGroupRequest)
    print(json.loads(putContactGroupResponse))

    # 5. Configure a threshold-triggered alert rule for a performance metric of a resource
    putResourceMetricRuleRequest = PutResourceMetricRuleRequest.PutResourceMetricRuleRequest()
    # The ID of the alert rule
    putResourceMetricRuleRequest.set_RuleId(uuid.uuid1())
    #The name of the alert rule
    putResourceMetricRuleRequest.set_RuleName("alert rule for unhealthy SLB backend servers")
    # The alert contact group. Separate multiple groups with commas (,)
    putResourceMetricRuleRequest.set_ContactGroups("the default alert contact group")
    # Set the namespace of SLB to acs_slb_dashboard
    putResourceMetricRuleRequest.set_Namespace(namespace)
    # The metric name, which is UnhealthyServerCount in this example. UnhealthyServerCount measures the number of unhealthy ECS instances
    putResourceMetricRuleRequest.set_MetricName("UnhealthyServerCount")
    # The resource for which the alert rule is applied
    putResourceMetricRuleRequest.set_Resources("[{'instanceId':'lb-bp13hithhod*******'}]")

    # Set Critical alerts
    # The statistical methods for Critical-level alerts. Average: average value
    putResourceMetricRuleRequest.set_EscalationsCriticalStatistics("Average")
    # The comparison operator of the threshold for Critical alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
    putResourceMetricRuleRequest.set_EscalationsCriticalComparisonOperator("GreaterThanOrEqualToThreshold")
    #The threshold for triggering critical alerts
    putResourceMetricRuleRequest.set_EscalationsCriticalThreshold("2")
    # The consecutive number of times for which the metric value meets the trigger condition before a Critical-level alert is triggered
    putResourceMetricRuleRequest.set_EscalationsCriticalTimes(5)

    # Set Info alerts
    # The statistical methods for Info-level alerts. Average: average value
    putResourceMetricRuleRequest.set_EscalationsInfoStatistics("Average")
    # The comparison operator of the threshold for Info alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
    putResourceMetricRuleRequest.set_EscalationsInfoComparisonOperator("GreaterThanOrEqualToThreshold")
    # The threshold for triggering Info alerts
    putResourceMetricRuleRequest.set_EscalationsInfoThreshold("1")
    # The consecutive number of times for which the metric value meets the trigger condition before an Info-level alert is triggered
    putResourceMetricRuleRequest.set_EscalationsInfoTimes(5)

    # Set Warn alerts
    # The statistical methods for Warn-level alerts. Average: average value
    putResourceMetricRuleRequest.set_EscalationsWarnStatistics("Average")
    # The comparison operator of the threshold for Warn alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
    putResourceMetricRuleRequest.set_EscalationsWarnComparisonOperator("GreaterThanOrEqualToThreshold")
    # The threshold for triggering Warn alerts
    putResourceMetricRuleRequest.set_EscalationsWarnThreshold("1")
    # The consecutive number of times for which the metric value meets the trigger condition before a Warn-level alert is triggered
    putResourceMetricRuleRequest.set_EscalationsWarnTimes(5)

    putResourceMetricRuleResponse = ACS_CLIENT.do_action_with_exception(putResourceMetricRuleRequest)
    print(json.loads(putResourceMetricRuleResponse))

    # 6. Query the alert rules
    describeMetricRuleListRequest = DescribeMetricRuleListRequest.DescribeMetricRuleListRequest()
    # Set the namespace of SLB to acs_slb_dashboard
    describeMetricRuleListRequest.set_Namespace(namespace)
    # Set the alert metrics that you want to query
    describeMetricRuleListRequest.set_MetricName("UnhealthyServerCount")
    describeMetricRuleListResponse = ACS_CLIENT.do_action_with_exception(describeMetricRuleListRequest)
    print(json.loads(describeMetricRuleListResponse))
            

Java examples

For example, assume that a TCP listener has been configured for the lb-bp13hithhod4aoxc***** instance. The following section describes how to set rules to trigger Critical, Warn, and Info alerts when the number of unhealthy ECS instances exceeds the specified thresholds.

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.ArrayList;
import java.util.List;
import java.util.UUID;

public class CreateMetricRuleDemo {

    public static void main(String[] args) throws ClientException {
        // 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);

        // The namespace
        String namespace = "acs_slb_dashboard";
        Gson gson = new Gson();


        // 2. Query the descriptions of time series metrics supported in Cloud Monitor.
        DescribeMetricMetaListRequest describeMetricMetaListRequest = new DescribeMetricMetaListRequest();
        // Set the namespace
        describeMetricMetaListRequest.setNamespace(namespace);
        // The number of records on each page. Default value: 30
        describeMetricMetaListRequest.setPageSize(100);
        DescribeMetricMetaListResponse describeMetricMetaListResponse = client.getAcsResponse(describeMetricMetaListRequest);
        System.out.println(gson.toJson(describeMetricMetaListResponse));


        // 3. Create an alert contact
        PutContactRequest putContactRequest = new PutContactRequest();
        // The name of the alert contact
        putContactRequest.setContactName("doctest");
        // The description of the alert contact
        putContactRequest.setDescribe("doctest");
        // The email address of the alert contact
        putContactRequest.setChannelsMail("u****e@example.com");
        PutContactResponse putContactResponse = client.getAcsResponse(putContactRequest);
        System.out.println(gson.toJson(putContactResponse));


        // 4. Create an alert contact group
        PutContactGroupRequest putContactGroupRequest = new PutContactGroupRequest();
        // The name of the alert contact group
        putContactGroupRequest.setContactGroupName("the default alert contact group");
        // The description of the alert contact group
        putContactGroupRequest.setDescribe("the default alert contact group");
        // The contacts in the alert contact group
        List<String> contactNames = new ArrayList<>();
        contactNames.add("doctest");
        putContactGroupRequest.setContactNamess(contactNames);
        PutContactGroupResponse putContactGroupResponse = client.getAcsResponse(putContactGroupRequest);
        System.out.println(gson.toJson(putContactGroupResponse));


        // 5. Configure a threshold-triggered alert rule for a performance metric of a resource
        PutResourceMetricRuleRequest putResourceMetricRuleRequest = new PutResourceMetricRuleRequest();
        // Generate a UUID that is in all lowercase letters and contains no hyphens (-) as the unique ID of the alert rule
        String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
        // The ID of the alert rule
        putResourceMetricRuleRequest.setRuleId(uuid);
        // The name of the alert rule
        putResourceMetricRuleRequest.setRuleName("alert rule for unhealthy SLB backend servers");
        // The alert contact group. Separate multiple groups with commas (,)
        putResourceMetricRuleRequest.setContactGroups("the default alert contact group");
        // Set the namespace of SLB to acs_slb_dashboard
        putResourceMetricRuleRequest.setNamespace(namespace);
        // The metric name, which is UnhealthyServerCount in this example. UnhealthyServerCount measures the number of unhealthy ECS instances
        putResourceMetricRuleRequest.setMetricName("UnhealthyServerCount");
        // The resource for which the alert rule is applied
        putResourceMetricRuleRequest.setResources("[{\"instanceId\":\"lb-bp13hithhod4aoxc*****\"}]");

        // Set Critical alerts
        // The statistical methods for Critical-level alerts. Average: average value
        putResourceMetricRuleRequest.setEscalationsCriticalStatistics("Average");
        // The comparison operator of the threshold for Critical alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
        putResourceMetricRuleRequest.setEscalationsCriticalComparisonOperator("GreaterThanOrEqualToThreshold");
        // The threshold for triggering Critical alerts
        putResourceMetricRuleRequest.setEscalationsCriticalThreshold("2");
        // The consecutive number of times for which the metric value meets the trigger condition before a Critical-level alert is triggered
        putResourceMetricRuleRequest.setEscalationsCriticalTimes(5);

        // Set Info alerts
        // The statistical methods for Info-level alerts. Average: average value
        putResourceMetricRuleRequest.setEscalationsInfoStatistics("Average");
        // The comparison operator of the threshold for Info alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
        putResourceMetricRuleRequest.setEscalationsInfoComparisonOperator("GreaterThanOrEqualToThreshold");
        // The threshold for triggering Info alerts
        putResourceMetricRuleRequest.setEscalationsInfoThreshold("1");
        // The consecutive number of times for which the metric value meets the trigger condition before an Info-level alert is triggered
        putResourceMetricRuleRequest.setEscalationsInfoTimes(5);

        // Set Warn alerts
        // The statistical methods for Warn-level alerts. Average: average value
        putResourceMetricRuleRequest.setEscalationsWarnStatistics("Average");
        // The comparison operator of the threshold for Warn alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
        putResourceMetricRuleRequest.setEscalationsWarnComparisonOperator("GreaterThanOrEqualToThreshold");
        // The threshold for triggering Warn alerts.
        putResourceMetricRuleRequest.setEscalationsWarnThreshold("1");
        // The consecutive number of times for which the metric value meets the trigger condition before a Warn-level alert is triggered
        putResourceMetricRuleRequest.setEscalationsWarnTimes(5);
        PutResourceMetricRuleResponse putResourceMetricRuleResponse = client.getAcsResponse(putResourceMetricRuleRequest);
        System.out.println(gson.toJson(putResourceMetricRuleResponse));


        // 6. Query the alert rules
        DescribeMetricRuleListRequest describeMetricRuleListRequest = new DescribeMetricRuleListRequest();
        // Set the namespace of SLB to acs_slb_dashboard
        describeMetricRuleListRequest.setNamespace(namespace);
        // Set the alert metrics that you want to query
        describeMetricRuleListRequest.setMetricName("UnhealthyServerCount");
        DescribeMetricRuleListResponse describeMetricRuleListResponse = client.getAcsResponse(describeMetricRuleListRequest);
        System.out.println(gson.toJson(describeMetricRuleListResponse));
    }
}
            

Returned result

The following responses are returned:

{'TotalCount': 53, 'RequestId': '96E7FB37-8BD5-48C3-AE0C-CBC03F8B7FD7', 'Resources': {'Resource': [{'MetricName': 'ActiveConnection', 'Periods': '60,300', 'Description': 'the number of active connections on a 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': 'the 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': 'the number of inactive connections on a 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': 'the maximum connection usage', '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': 'the usage 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 usage', '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': 'the number of new connections on a 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 over a port per second', '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 over a port per second', '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 over a port per second', '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 over a port per second', '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': 'the current number of unhealthy 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': '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'}]}, 'Code': 200, 'Success': True}
{'RequestId': '653C4634-C32B-4858-B2BA-BAFC22DAF8FF', 'Code': '200', 'Success': True}
{'RequestId': '088D3BFF-DCED-4892-AE1D-468120BB6D74', 'Code': '200', 'Success': True}
{'Message': '', 'RequestId': '149A6CBC-1182-4749-8AD6-F55C563B9020', 'Code': 200, 'Success': True}
{'RequestId': '3E6ED37E-F5F3-472D-AF4D-8117329EAEC5', 'Total': 1, 'Alarms': {'Alarm': [{'GroupName': '', 'SilenceTime': 86400, 'ContactGroups': 'the default alert contact group', 'NoEffectiveInterval': '', 'MailSubject': '${serviceType}-${metricName}-${levelDescription}notification(${dimensions})', 'RuleId': 'edc0e1ae-7ef8-11ea-bf2d-54ee75d07c7c', 'SourceType': 'METRIC', 'Period': 300, 'Dimensions': '', 'EffectiveInterval': '', 'Namespace': 'acs_slb_dashboard', 'AlertState': 'OK', 'GroupId': '', 'MetricName': 'UnhealthyServerCount', 'EnableState': True, 'Escalations': {'Critical': {'ComparisonOperator': 'GreaterThanOrEqualToThreshold', 'Times': 5, 'Statistics': 'Average', 'Threshold': '2'}, 'Info': {'ComparisonOperator': 'GreaterThanOrEqualToThreshold', 'Times': 5, 'Statistics': 'Average', 'Threshold': '1'}, 'Warn': {'ComparisonOperator': 'GreaterThanOrEqualToThreshold', 'Times': 5, 'Statistics': 'Average', 'Threshold': '1'}}, 'Webhook': '', 'Resources': '[{"instanceId":"lb-bp13hithhod4aoxc*****"}]', 'RuleName': 'alert rule for unhealthy SLB backend servers'}]}, 'Code': '200', 'Success': True}