All Products
Search
Document Center

CloudMonitor:DescribeAlertingMetricRuleResources

Last Updated:Mar 01, 2024

Queries the resources for which active alerts are triggered based on an alert rule.

Debugging

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

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RuleIdstringNo

The ID of the alert rule. For information about how to obtain the ID of an alert rule, see DescribeMetricRuleList .

putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****
GroupIdstringNo

The ID of the application group. For information about how to obtain the ID of an application group, see DescribeMonitorGroups .

7671****
PageintegerNo

The page number.

Default value: 1.

1
PageSizeintegerNo

The number of entries per page.

Default value: 10.

10
NamespacestringNo

The namespace of the cloud service.

For more information about the namespaces of cloud services, see Appendix 1: Metrics.

acs_mns_new
DimensionsstringNo

The dimensions that specify the resources whose monitoring data you want to query.

{\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"}
AlertBeforeTimestringNo

Queries the alerts that were triggered before the specified time. Timestamps in milliseconds are supported.

1698827400000

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object

None.

Codeinteger

The status code.

Note The status code 200 indicates that the request was successful.
200
Messagestring

The error message.

The request processing has failed due to some unknown error.
RequestIdstring

The request ID.

0724011B-D9E0-4B2F-8C51-F17A894CC42C
Totalinteger

The total number of entries returned.

2
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
Resourcesobject []

The resources that are associated with the alert rule.

MetricNamestring

The metric name.

ActiveMessages
RetryTimesstring

The consecutive number of times for which the metric value meets the alert condition before an alert is triggered.

3
MetricValuesstring

The metric value that triggered the alert based on the alert rule. The value is a JSON string.

{\"timestamp\":1623727500000,\"Sum\":926,\"value\":463,\"Maximum\":463,\"Minimum\":463,\"Average\":463,\"SampleCount\":2,\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"}
Namespacestring

The namespace of the cloud service.

acs_mns_new
RuleNamestring

The name of the alert rule.

test123456789
RuleIdstring

The ID of the alert rule.

putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****
ProductCategorystring

The type of the cloud service.

mns
StartTimestring

The time when the resource was associated with the alert rule. The value is a timestamp.

Unit: milliseconds.

1622427900000
Resourcestring

The resources that are monitored.

userId=120886317861****,region=cn-huhehaote,queue=test-0128
LastModifyTimestring

The time when the alert rule was last modified. The value is a timestamp.

Unit: milliseconds.

1622827900000
GroupIdstring

The ID of the application group.

Note If the alert rule is associated with an application group, the ID of the application group is returned in this parameter.
7671****
Dimensionsstring

The dimensions based on which the resources are queried.

{\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\",\"userId\":\"120886317861****\"}
LastAlertTimestring

The time when the last alert was triggered for the resource based on the alert rule. The value is a timestamp.

Unit: milliseconds.

1622427900000
Levelinteger

The severity level and notification methods of the alert. Valid values:

  • 4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
3
Thresholdstring

The alert threshold.

10
Statisticsstring

The method used to calculate the metric values that trigger alerts.

Average
Enablestring

Indicates whether the alert rule is enabled. Valid values:

  • true: The alert rule is enabled.
  • false: The alert rule is disabled.
true
Escalationobject []

The alert rule based on which the alert is triggered.

ComparisonOperatorstring

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
GreaterThanOrEqualToThreshold
PreConditionstring

The operator that is used to compare the metric value with the threshold. Valid values:

  • >=
  • =
  • <=
  • >
  • <
  • !=
>=
Expressionstring

The description of the alert rule.

Note This parameter indicates the content of the alert rule. If the metric value meets the alert condition, an alert is triggered.
$Average>=10
Timesinteger

The consecutive number of times for which the metric value meets the alert condition before an alert is triggered.

1
Tagstring

This parameter is deprecated.

mns
Thresholdstring

The alert threshold.

10
Levelinteger

The severity level and notification methods of the alert. Valid values:

  • 4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
3
ExpressionListJoinstring

The relationship between multiple metrics. Valid values:

  • &&: If all metrics meet the alert conditions, CloudMonitor sends alert notifications.
  • ||: If one of the metrics meets the alert conditions, CloudMonitor sends alert notifications.
&&
ExpressionListobject []

The description of the multi-metric alert rule.

ComparisonOperatorstring

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
GreaterThanOrEqualToThreshold
MetricNamestring

The metric name.

cpu_total
Periodstring

The statistical period of the metric. Unit: seconds. The default value is the interval at which the monitoring data of the metric is collected.

60
Statisticsstring

The statistical method of the alert level. Valid values:

  • Maximum
  • Minimum
  • Average
Average
Thresholdstring

The alert threshold.

90
ExpressionRawstring

The trigger conditions that are created by using expressions. You can use expressions to create trigger conditions in the following scenarios:

  • Set an alert blacklist for specific resources. For example, if you specify $instanceId != 'i-io8kfvcpp7x5****' ``&&`` $Average > 50, no alert is triggered when the average metric value of the i-io8kfvcpp7x5**** instance exceeds 50.
  • Set a special alert threshold for a specified instance in the rule. For example, if you specify $Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50), an alert is triggered when the average metric value of the i-io8kfvcpp7x5**** instance exceeds 80 or the average metric value of other instances exceeds 50.
  • Limit the number of instances whose metric values exceed the threshold. For example, if you specify count($Average > 20) > 3, an alert is triggered only when the average metric value of more than three instances exceeds 20.
$Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50)

Examples

Sample success responses

JSONformat

{
  "Code": 200,
  "Message": "The request processing has failed due to some unknown error.",
  "RequestId": "0724011B-D9E0-4B2F-8C51-F17A894CC42C",
  "Total": 2,
  "Success": true,
  "Resources": {
    "Resource": [
      {
        "MetricName": "ActiveMessages",
        "RetryTimes": "3",
        "MetricValues": "{\\\"timestamp\\\":1623727500000,\\\"Sum\\\":926,\\\"value\\\":463,\\\"Maximum\\\":463,\\\"Minimum\\\":463,\\\"Average\\\":463,\\\"SampleCount\\\":2,\\\"userId\\\":\\\"120886317861****\\\",\\\"region\\\":\\\"cn-huhehaote\\\",\\\"queue\\\":\\\"test-0128\\\"}",
        "Namespace": "acs_mns_new",
        "RuleName": "test123456789",
        "RuleId": "putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****",
        "ProductCategory": "mns",
        "StartTime": "1622427900000",
        "Resource": "userId=120886317861****,region=cn-huhehaote,queue=test-0128",
        "LastModifyTime": "1622827900000",
        "GroupId": "7671****",
        "Dimensions": "{\\\"region\\\":\\\"cn-huhehaote\\\",\\\"queue\\\":\\\"test-0128\\\",\\\"userId\\\":\\\"120886317861****\\\"}",
        "LastAlertTime": "1622427900000",
        "Level": 3,
        "Threshold": "10",
        "Statistics": "Average",
        "Enable": "true",
        "Escalation": {
          "Resource": [
            {
              "ComparisonOperator": "GreaterThanOrEqualToThreshold",
              "PreCondition": ">=",
              "Expression": "$Average>=10",
              "Times": 1,
              "Tag": "mns",
              "Threshold": "10",
              "Level": 3,
              "ExpressionListJoin": "&&",
              "ExpressionList": {
                "ExpressionList": [
                  {
                    "ComparisonOperator": "GreaterThanOrEqualToThreshold",
                    "MetricName": "cpu_total",
                    "Period": "60",
                    "Statistics": "Average",
                    "Threshold": "90"
                  }
                ]
              },
              "ExpressionRaw": "$Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50)"
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError message
400%s%s
500InternalErrorThe request processing has failed due to some unknown error.

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

Change history

Change timeSummary of changesOperation
2023-10-20The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
    delete Error Codes: 503
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: AlertBeforeTime