All Products
Search
Document Center

Server Load Balancer:Configure alert rules

Last Updated:Nov 03, 2023

After you activate CloudMonitor, you can configure alert rules for Classic Load Balancer (CLB) instances in the CloudMonitor console, by calling API operations, or by using SDKs.

Background information

If a CLB instance or a CLB listener is deleted, the alert rules configured for the CLB instance or listener are also deleted.

Prerequisites

  • A CLB instance is created, a listener is added to the CLB instance, and health checks are enabled for the CLB instance. For more information, see the following topics:

  • The service label that is used to configure alert rules for CLB in CloudMonitor is obtained. In this example, the service label is SLB.

  • The namespace of CLB in CloudMonitor is obtained. In this example, the namespace is acs_slb_dashboard. For more information about how to obtain the namespace, see DescribeProjectMeta.

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

  3. On the Instances page, find the instance that you want to manage and click the icon in the Monitoring column.

  4. In the Monitoring Information panel, click Switch to Earlier Version. If you use the earlier version, skip this step.

  5. In the Monitoring Data panel, click Threshold Alerting Settings.

  6. On the Alert Rules page of the CloudMonitor console, click Create Alert Rule.

  7. In the Create Alert Rule panel, configure an alert rule. For more information, see Create an alert rule.

Configure alert rules by calling API operations

The following figure shows the procedure for configuring alert rules by calling API operations.通过API设置报警规则_流程图

  1. Optional: Call the DescribeMetricMetaList operation to query the descriptions of time series metrics that are available in CloudMonitor or view the descriptions of the metrics in 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.

In this example, a TCP listener is configured for the lb-bp1rbwvouuyipbc*** 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.

DescribeMetricMetaList

Call the DescribeMetricMetaList operation to query the descriptions of time series metrics that are available in CloudMonitor.

  1. Set the request parameter Namespace to acs_slb_dashboard and use the default values for other parameters.

    Sample request:

    http(s)://[Endpoint]/?Action=DescribeMetricMetaList
    &Namespace=acs_slb_dashboard
    &<Common request parameters>
  2. View the time series metrics of CLB based on the returned parameters. Check whether the Qps parameter is returned in this example.

    Sample 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 exists, you can call this operation to modify 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 use 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 request:

    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 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 the 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 use 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 request:

    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 response:

    {
        "RequestId": "B8B88837-99A4-4F0D-B445-5E9C072D154D", 
        "Code": "200", 
        "Success": true
    }

PutResourceMetricRule

Call the PutResourceMetricRule operation to configure a threshold-triggered 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 use the default values for other parameters.

    Parameter

    Description

    RuleId

    The ID of the alert rule.

    Namespace

    The namespace of CLB. Set the value to acs_slb_dashboard.

    MetricName

    The name of the metric. You can view the descriptions of metrics by calling the DescribeMetricRuleList operation or in the Monitoring and alerting metrics topic.

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

    Resources

    The resource to which the alert rule is applied. If you want to associate the alert rule with a CLB instance, specify the instance in the [{"instanceId":"lb-bp1rbwvouu******"}] format.

    ContactGroups

    The alert contact group. Separate multiple groups with commas (,).

    Escalations.Critical.Statistics

    The statistical method for Critical-level alerts. Valid values:

    • Average: the average value

    • Minimum: the minimum value

    • Maximum: the maximum value

    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 method for Warn-level alerts. Valid values:

    • Average: the average value

    • Minimum: the minimum value

    • Maximum: the maximum value

    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 method for Info-level alerts. Valid values:

    • Average: the average value

    • Minimum: the minimum value

    • Maximum: the maximum value

    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 request:

    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 value of the returned Success parameter.

    Sample response:

    {
        "Message":"",
        "RequestId":"C65B0B84-DDE8-4DCA-8663-5836773102D4",
        "Success":true,
        "Code":"200"
    }

DescribeMetricRuleList

Call the DescribeMetricRuleList operation to query alert rules.

  1. Set the CLB namespace and alert metrics to query detailed information about the alert metrics in the request parameters.

    In this example, configure the following parameters and use the default values for other parameters.

    • Namespace: Set the namespace of CLB 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 response:

    {
        "RequestId": "F249E314-1763-4662-A347-BD54C739191E", 
        "Total": 1, 
        "Alarms": {
            "Alarm": [
                {
                    "GroupName": "", 
                    "SilenceTime": 86400, 
                    "ContactGroups": "doctestgroup", 
                    "NoEffectiveInterval": "", 
                    "MailSubject": "${serviceType}-${metricName}-${levelDescription}Info(${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 SDKs

The following figure shows the procedure for configuring alert rules by calling CloudMonitor SDKs.通过API设置报警规则_流程图

  1. Optional: Call the DescribeMetricMetaList operation to query the descriptions of time series metrics that are available in CloudMonitor or view the descriptions of the metrics in 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, a TCP listener is 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
from aliyunsdkcore.auth.credentials import AccessKeyCredential
from aliyunsdkcore.auth.credentials import StsTokenCredential
import json, uuid
import os

if __name__ == '__main__':
    #1. Initialize the SDK
    # Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
    credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'],
                                      os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'])
    # use STS Token
    # credentials = StsTokenCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'], os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'], os.environ['ALIBABA_CLOUD_SECURITY_TOKEN'])
    
    ACS_CLIENT = AcsClient(region_id='cn-hangzhou', credential=credentials)

    # Specify the namespace
    namespace = "acs_slb_dashboard"

    # 2. Query the descriptions of time series metrics supported in CloudMonitor
    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("Default alert contact group")
    # The description of the alert contact group
    putContactGroupRequest.set_Describe("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 CLB backend servers")
    # The alert contact group. Separate multiple groups with commas (,)
    putResourceMetricRuleRequest.set_ContactGroups("Default alert contact group")
    # Set the namespace of CLB 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 to which the alert rule is applied
    putResourceMetricRuleRequest.set_Resources("[{'instanceId':'lb-bp13hithhod*******'}]")

    # Set Critical-level alerts
    # The statistical method for Critical-level alerts. Average: average value
    putResourceMetricRuleRequest.set_EscalationsCriticalStatistics("Average")
    # The comparison operator of the threshold for Critical-level alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
    putResourceMetricRuleRequest.set_EscalationsCriticalComparisonOperator("GreaterThanOrEqualToThreshold")
    #The threshold for triggering Critical-level 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-level alerts
    # The statistical method for Info-level alerts. Average: average value
    putResourceMetricRuleRequest.set_EscalationsInfoStatistics("Average")
    # The comparison operator of the threshold for Info-level alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
    putResourceMetricRuleRequest.set_EscalationsInfoComparisonOperator("GreaterThanOrEqualToThreshold")
    # The threshold for triggering Info-level 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-level alerts
    # The statistical method for Warn-level alerts. Average: average value
    putResourceMetricRuleRequest.set_EscalationsWarnStatistics("Average")
    # The comparison operator of the threshold for Warn-level alerts. GreaterThanOrEqualToThreshold: greater than or equal to the threshold
    putResourceMetricRuleRequest.set_EscalationsWarnComparisonOperator("GreaterThanOrEqualToThreshold")
    # The threshold for triggering Warn-level 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 CLB 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, a TCP listener is 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.

package com.aliyun.cms;

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
        // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou", // The ID of the region
                System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"),// Your AccessKey ID
                System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));// Your AccessKey secret
        /** use STS Token
         DefaultProfile profile = DefaultProfile.getProfile(
         "<your-region-id>",           // The region ID
         System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"),       // The AccessKey ID of the RAM account
         System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),   // The AccessKey Secret of the RAM account
         System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN"));     // STS Token
         **/
    
        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 CloudMonitor.
        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("Default alert contact group");
        // The description of the alert contact group
        putContactGroupRequest.setDescribe("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 CLB backend servers");
        // The alert contact group. Separate multiple groups with commas (,)
        putResourceMetricRuleRequest.setContactGroups("Default alert contact group");
        // Set the namespace of CLB 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 to which the alert rule is applied
        putResourceMetricRuleRequest.setResources("[{\"instanceId\":\"lb-bp13hithhod4aoxc*****\"}]");

        // Set Critical-level alerts
        // The statistical method 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-level 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-level alerts
        // The statistical method 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-level 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-level alerts
        // The statistical method 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-level 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 CLB 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));
    }
}
            

The response parameters.

The following responses are returned:

{'TotalCount': 53, 'RequestId': '96E7FB37-8BD5-48C3-AE0C-CBC03F8B7FD7', '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'}, {'MetricName': 'InstanceStatusCodeOther', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceTrafficRX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceTrafficTX', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceUpstreamCode4xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceUpstreamCode5xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'InstanceUpstreamRt', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId', 'Labels': '[{"name":"alertUnit","value":"ms"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"instanceId"},{"name":"is_alarm","value":"true"}]', 'Unit': 'ms', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'MaxConnection', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Maximum,Minimum,Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'NewConnection', 'Periods': '60,300', 'Description': 'Number of new connections on the port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'PacketRX', 'Periods': '60,300', 'Description': 'Number of inbound packets per second on the port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'PacketTX', 'Periods': '60,300', 'Description': 'Number of outbound packets per second on the port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'Qps', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'Rt', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"ms"},{"name":"alertDefault","value":"ms"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': '', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode2xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/s"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/s', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode3xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode4xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCode5xx', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'StatusCodeOther', 'Periods': '60,300', 'Description': '', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Count/Second"},{"name":"minAlertPeriod","value":"60"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'Count/Second', 'Statistics': 'Average', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'TrafficRXNew', 'Periods': '60,300', 'Description': 'Inbound traffic per second on the port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'TrafficTXNew', 'Periods': '60,300', 'Description': 'Outbound traffic per second on the port', 'Dimensions': 'userId,instanceId,port,protocol', 'Labels': '[{"name":"alertUnit","value":"Mbits/s"},{"name":"minAlertPeriod","value":"60"},{"name":"unitFactor","value":"1048576"},{"name":"metricCategory","value":"port"},{"name":"is_alarm","value":"true"}]', 'Unit': 'bits/s', 'Statistics': 'Average,Minimum,Maximum', 'Namespace': 'acs_slb_dashboard'}, {'MetricName': 'UnhealthyServerCount', 'Periods': '60,300', 'Description': 'Number of unhealthy backend 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': 'Default alert contact group', 'NoEffectiveInterval': '', 'MailSubject': '${serviceType}-${metricName}-${levelDescription}Info(${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 CLB backend servers'}]}, 'Code': '200', 'Success': True}