调用DescribeAlertingMetricRuleResources接口查询指定报警规则中正在发生报警的资源列表。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DescribeAlertingMetricRuleResources |
要执行的操作,取值:DescribeAlertingMetricRuleResources。 |
RuleId | String | 否 | putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108**** |
报警规则ID。关于如何查询报警规则ID,请参见DescribeMetricRuleList。 |
GroupId | String | 否 | 7671**** |
应用分组ID。关于如何查询应用分组ID,请参见DescribeMonitorGroups。 |
Page | Integer | 否 | 1 |
分页页码。 默认值:1 。 |
PageSize | Integer | 否 | 10 |
分页大小。 默认值:10。 |
Namespace | String | 否 | acs_mns_new |
云产品的数据命名空间。 关于如何获取云产品的数据命名空间,请参见云产品监控项。 |
Dimensions | String | 否 | {\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"} |
维度Map,用于查询指定资源的监控数据。 |
关于公共请求参数的详情,请参见公共参数。
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Code | Integer | 200 |
状态码。 说明 200表示成功。
|
Message | String | The request processing has failed due to some unknown error. |
错误信息。 |
RequestId | String | 0724011B-D9E0-4B2F-8C51-F17A894CC42C |
请求ID。 |
Total | Integer | 2 |
总记录条数。 |
Success | Boolean | true |
操作是否成功。取值:
|
Resources | Array of Resource |
报警规则的资源列表。 |
|
Resource | |||
MetricName | String | ActiveMessages |
监控项名称。 |
RetryTimes | String | 3 |
报警重试次数。 |
MetricValues | String | {\"timestamp\":1623727500000,\"Sum\":926,\"value\":463,\"Maximum\":463,\"Minimum\":463,\"Average\":463,\"SampleCount\":2,\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"} |
触发报警时监控项的值。格式为一个JSON字符串。 |
Namespace | String | acs_mns_new |
云产品的数据命名空间。 |
RuleName | String | test123456789 |
报警规则名称。 |
RuleId | String | putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108**** |
报警规则ID。 |
ProductCategory | String | mns |
云产品类型。 |
StartTime | String | 1622427900000 |
资源被关联到报警规则的时间戳。 单位:毫秒。 |
Resource | String | userId=120886317861****,region=cn-huhehaote,queue=test-0128 |
报警的资源。 |
LastModifyTime | String | 1622827900000 |
最后一次修改报警规则的时间戳。 单位:毫秒。 |
GroupId | String | 7671**** |
应用分组ID。 说明 如果报警规则与指定应用分组关联,则显示该应用分组ID。
|
Dimensions | String | {\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\",\"userId\":\"120886317861****\"} |
维度Map,用于查询指定资源的监控数据。 |
LastAlertTime | String | 1622427900000 |
最后一次触发报警的时间戳。 单位:毫秒。 |
Level | Integer | 3 |
报警的级别和通知方式。取值:
|
Threshold | String | 10 |
报警阈值。 |
Statistics | String | Average |
报警统计方法。 |
Enable | String | true |
是否启用报警规则。取值:
|
Escalation | Array of Resource |
触发报警的规则。 |
|
Resource | |||
ComparisonOperator | String | GreaterThanOrEqualToThreshold |
阈值比较符。取值:
|
PreCondition | String | >= |
阈值比较符号。取值:
|
Expression | String | $Average>=10 |
触发报警的规则描述。 说明 报警规则的主体,当监控数据满足报警条件时,触发报警规则。
|
Times | Integer | 1 |
报警重试次数。 |
Tag | String | mns |
资源的标签。 |
Threshold | String | 10 |
报警阈值。 |
Level | Integer | 3 |
报警的级别和通知方式。取值:
|
ExpressionListJoin | String | && |
多个监控项之间的关系。取值:
|
ExpressionList | Array of ExpressionList |
多指标报警规则描述。 |
|
ExpressionList | |||
ComparisonOperator | String | GreaterThanOrEqualToThreshold |
报警级别的阈值比较符。取值:
|
MetricName | String | cpu_total |
监控项名称。 |
Period | String | 60 |
监控项的统计周期。单位:秒。默认为监控项的原始上报周期。 |
Statistics | String | Average |
报警级别的统计方法。取值:
|
Threshold | String | 90 |
报警阈值。 |
ExpressionRaw | String | $Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50) |
表达式创建的报警条件。包括但不限于以下情况:
|
示例
请求示例
http(s)://[Endpoint]/?Action=DescribeAlertingMetricRuleResources
&<公共请求参数>
正常返回示例
XML
格式
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
格式
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
}
错误码
访问错误中心查看更多错误码。