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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeAlertingMetricRuleResources

The operation that you want to perform. Set the value to DescribeAlertingMetricRuleResources.

RuleId String No putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****

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

GroupId String No 7671****

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

Page Integer No 1

The number of the page to return.

Default value: 1.

PageSize Integer No 10

The number of entries to return on each page.

Default value: 10.

Namespace String No acs_mns_new

The namespace of the cloud service.

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

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

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

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

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code.

Note The status code 200 indicates that the call was successful.
Message String The request processing has failed due to some unknown error.

The error message.

RequestId String 0724011B-D9E0-4B2F-8C51-F17A894CC42C

The ID of the request.

Total Integer 2

The total number of returned entries.

Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
Resources Array of Resource

The resources to which the alert rule is applied.

Resource
MetricName String ActiveMessages

The name of the metric.

RetryTimes String 3

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

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

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

Namespace String acs_mns_new

The namespace of the cloud service.

RuleName String test123456789

The name of the alert rule.

RuleId String putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****

The ID of the alert rule.

ProductCategory String mns

The type of the cloud service.

StartTime String 1622427900000

The time when the resource was associated with the alert rule.

Unit: milliseconds.

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

The resources that are monitored.

LastModifyTime String 1622827900000

The timestamp when the alert rule was last modified.

Unit: milliseconds.

GroupId String 7671****

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.
Dimensions String {\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\",\"userId\":\"120886317861****\"}

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

LastAlertTime String 1622427900000

The timestamp when the last alert was triggered for the resource based on the alert rule.

Unit: milliseconds.

Level Integer 3

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

  • 4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
Threshold String 10

The alert threshold.

Statistics String Average

The method used to calculate metric values that trigger alerts.

Enable String true

Indicates whether the alert rule is enabled. Valid values:

  • true: The alert rule is enabled.
  • false: The alert rule is disabled.
Escalation Array of Resource

The alert rule based on which the alert is triggered.

Resource
ComparisonOperator String GreaterThanOrEqualToThreshold

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
PreCondition String >=

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

  • >=
  • =
  • <=
  • >
  • <
  • !=
Expression String $Average>=10

The description of the alert rule.

Note This parameter is the content of the alert rule. If the metric value meets the alert condition, an alert is triggered.
Times Integer 1

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

Tag String mns

The tags of the instance.

Threshold String 10

The alert threshold.

Level Integer 3

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

  • 4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
ExpressionListJoin String &&

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.
ExpressionList Array of ExpressionList

The description of the multi-metric alert rule.

ExpressionList
ComparisonOperator String GreaterThanOrEqualToThreshold

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
MetricName String cpu_total

The name of the metric.

Period String 60

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

Statistics String Average

The statistical method of the alert level. Valid values:

  • Maximum: the maximum value
  • Minimum: the minimum value
  • Average: the average value
Threshold String 90

The alert threshold.

ExpressionRaw String $Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50)

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 generated even 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.
  • Limits 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 number of instances whose average metric value exceeds 20 exceeds three.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeAlertingMetricRuleResources
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeAlertingMetricRuleResourcesResponse>
	<RequestId>0724011B-D9E0-4B2F-8C51-F17A894CC42C</RequestId>
	<Message></Message>
	<Total>2</Total>
	<Resources>
		<Resource>
			<RuleId>putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****</RuleId>
			<Escalation>
				<Resource>
					<Expression>$Average>=10</Expression>
					<Times>1</Times>
					<Level>3</Level>
					<Tag>mns</Tag>
				</Resource>
			</Escalation>
			<Resource>userId=120886317861****,region=cn-huhehaote,queue=test-0128</Resource>
			<StartTime>1622427900000</StartTime>
			<Dimensions>{\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"}</Dimensions>
			<MetricValues>{\"timestamp\":1623727500000,\"Sum\":926,\"value\":463,\"Maximum\":463,\"Minimum\":463,\"Average\":463,\"SampleCount\":2,\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"}</MetricValues>
			<LastModifyTime>1623727904000</LastModifyTime>
			<Statistics>Average</Statistics>
			<Namespace>acs_mns_new</Namespace>
			<GroupId>7671****</GroupId>
			<MetricName>ActiveMessages</MetricName>
			<LastAlertTime>1622427900000</LastAlertTime>
			<ProductCategory>mns</ProductCategory>
			<Enable>true</Enable>
			<Level>3</Level>
			<RuleName>test123456789</RuleName>
			<RetryTimes>1</RetryTimes>
			<Threshold>10</Threshold>
		</Resource>
		<Resource>
			<RuleId>putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****</RuleId>
			<Escalation>
				<Resource>
					<Expression>$Average>=10</Expression>
					<Times>1</Times>
					<Level>3</Level>
					<Tag>mns</Tag>
				</Resource>
			</Escalation>
			<Resource>userId=120886317861****,region=cn-huhehaote,queue=test-022401-1</Resource>
			<StartTime>1622427900000</StartTime>
			<Dimensions>{\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-022401-1\"}</Dimensions>
			<MetricValues>{\"timestamp\":1623727500000,\"queue\":\"test-022401-1\",\"Maximum\":349,\"Minimum\":349,\"Sum\":698,\"value\":349,\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"Average\":349,\"SampleCount\":2}</MetricValues>
			<LastModifyTime>1623727904000</LastModifyTime>
			<Statistics>Average</Statistics>
			<Namespace>acs_mns_new</Namespace>
			<GroupId>7671****</GroupId>
			<MetricName>ActiveMessages</MetricName>
			<LastAlertTime>1622427900000</LastAlertTime>
			<ProductCategory>mns</ProductCategory>
			<Enable>true</Enable>
			<Level>3</Level>
			<RuleName>test123456789</RuleName>
			<RetryTimes>1</RetryTimes>
			<Threshold>10</Threshold>
		</Resource>
	</Resources>
	<Success>true</Success>
</DescribeAlertingMetricRuleResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "0724011B-D9E0-4B2F-8C51-F17A894CC42C",
  "Message" : "",
  "Total" : 2,
  "Resources" : {
    "Resource" : [ {
      "RuleId" : "putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****",
      "Escalation" : {
        "Resource" : [ {
          "Expression" : "$Average>=10",
          "Times" : 1,
          "Level" : 3,
          "Tag" : "mns"
        } ]
      },
      "Resource" : "userId=120886317861****,region=cn-huhehaote,queue=test-0128",
      "StartTime" : 1622427900000,
      "Dimensions" : "{\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"}",
      "MetricValues" : "{\"timestamp\":1623727500000,\"Sum\":926,\"value\":463,\"Maximum\":463,\"Minimum\":463,\"Average\":463,\"SampleCount\":2,\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"}",
      "LastModifyTime" : 1623727904000,
      "Statistics" : "Average",
      "Namespace" : "acs_mns_new",
      "GroupId" : "7671****",
      "MetricName" : "ActiveMessages",
      "LastAlertTime" : 1622427900000,
      "ProductCategory" : "mns",
      "Enable" : true,
      "Level" : 3,
      "RuleName" : "test123456789",
      "RetryTimes" : 1,
      "Threshold" : "10"
    }, {
      "RuleId" : "putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108****",
      "Escalation" : {
        "Resource" : [ {
          "Expression" : "$Average>=10",
          "Times" : 1,
          "Level" : 3,
          "Tag" : "mns"
        } ]
      },
      "Resource" : "userId=120886317861****,region=cn-huhehaote,queue=test-022401-1",
      "StartTime" : 1622427900000,
      "Dimensions" : "{\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-022401-1\"}",
      "MetricValues" : "{\"timestamp\":1623727500000,\"queue\":\"test-022401-1\",\"Maximum\":349,\"Minimum\":349,\"Sum\":698,\"value\":349,\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"Average\":349,\"SampleCount\":2}",
      "LastModifyTime" : 1623727904000,
      "Statistics" : "Average",
      "Namespace" : "acs_mns_new",
      "GroupId" : "7671****",
      "MetricName" : "ActiveMessages",
      "LastAlertTime" : 1622427900000,
      "ProductCategory" : "mns",
      "Enable" : true,
      "Level" : 3,
      "RuleName" : "test123456789",
      "RetryTimes" : 1,
      "Threshold" : "10"
    } ]
  },
  "Success" : true
}

Error codes

For a list of error codes, visit the API Error Center.