查詢指定警示規則中正在發生警示的資源清單。
介面說明
本文將提供一個範例,為雲端伺服器 ECS acs_ecs_dashboard 的執行個體 i-uf6j91r34rnwawoo**** 中的監控項目 cpu_total 設定閾值警示規則。該警示規則的警示聯絡群組為 ECS_Group、警示規則名稱為 test123、警示規則 ID 為 a151cd6023eacee2f0978e03863cc1697c89508****、Critical 等級的統計方法為 Average、Critical 等級的比較運算子為 GreaterThanOrEqualToThreshold、Critical 等級的閾值為 90,以及 Critical 等級的警示重試次數為 3。
2024-08-15 新增 Statistics 驗證,統計值只能填寫對應指標的 Statistics。關於如何取得此參數的取值,請參閱雲端產品監控項目。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
cms:DescribeAlertingMetricRuleResources |
get |
*全部資源。
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RuleId |
string |
否 |
警示規則 ID。關於如何查詢警示規則 ID,請參閱 DescribeMetricRuleList 。 |
putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108**** |
| GroupId |
string |
否 |
應用程式分組 ID。關於如何查詢應用程式分組 ID,請參閱 DescribeMonitorGroups 。 |
7671**** |
| Page |
integer |
否 |
分頁頁碼。 預設值:1。 |
1 |
| PageSize |
integer |
否 |
分頁大小。 預設值:10。 |
10 |
| Namespace |
string |
否 |
雲端產品的資料命名空間。 關於如何取得雲端產品的資料命名空間,請參閱雲端產品監控項目。 |
acs_mns_new |
| Dimensions |
string |
否 |
維度 Map,用於查詢指定資源的監控資料。 |
{\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"} |
| AlertBeforeTime |
string |
否 |
用於查詢在此時刻之前發生的警示。支援毫秒時間戳記。 |
1698827400000 |
關於公用請求參數的詳細資訊,請參閱公用參數。
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
無。 |
||
| Code |
integer |
狀態碼。 說明
200 表示成功。 |
200 |
| Message |
string |
錯誤訊息。 |
The request processing has failed due to some unknown error. |
| RequestId |
string |
請求 ID。 |
0724011B-D9E0-4B2F-8C51-F17A894CC42C |
| Total |
integer |
總記錄筆數。 |
2 |
| Success |
boolean |
操作是否成功。取值:
|
true |
| Resources |
object |
||
| Resource |
array<object> |
警示規則的資源清單。 |
|
|
array<object> |
無。 |
||
| MetricName |
string |
監控項目名稱。 |
ActiveMessages |
| RetryTimes |
string |
警示重試次數。 |
3 |
| MetricValues |
string |
觸發警示時監控項目的值。格式為一個 JSON 字串。 |
{\"timestamp\":1623727500000,\"Sum\":926,\"value\":463,\"Maximum\":463,\"Minimum\":463,\"Average\":463,\"SampleCount\":2,\"userId\":\"120886317861****\",\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\"} |
| Namespace |
string |
雲端產品的資料命名空間。 |
acs_mns_new |
| RuleName |
string |
警示規則名稱。 |
test123456789 |
| RuleId |
string |
警示規則 ID。 |
putNewAlarm_user_7e78d765-0e3e-4671-ba6d-7ce39108**** |
| ProductCategory |
string |
雲端產品類型。 |
mns |
| StartTime |
string |
資源被關聯到警示規則的時間戳記。 單位:毫秒。 |
1622427900000 |
| Resource |
string |
發生警示的資源。 |
userId=120886317861****,region=cn-huhehaote,queue=test-0128 |
| LastModifyTime |
string |
最後一次修改警示規則的時間戳記。 單位:毫秒。 |
1622827900000 |
| GroupId |
string |
應用程式分組 ID。 說明
如果警示規則與指定應用程式分組關聯,則顯示該應用程式分組 ID。 |
7671**** |
| Dimensions |
string |
維度 Map,用於查詢指定資源的監控資料。 |
{\"region\":\"cn-huhehaote\",\"queue\":\"test-0128\",\"userId\":\"120886317861****\"} |
| LastAlertTime |
string |
最後一次觸發警示的時間戳記。 單位:毫秒。 |
1622427900000 |
| Level |
integer |
警示的層級和通知方式。取值:
|
3 |
| Threshold |
string |
警示閾值。 |
10 |
| Statistics |
string |
警示統計方法。 |
Average |
| Enable |
string |
是否啟用警示規則。取值:
|
true |
| Escalation |
object |
||
| Resource |
array<object> |
觸發警示的規則。 |
|
|
array<object> |
無。 |
||
| ComparisonOperator |
string |
閾值比較運算子。取值:
|
GreaterThanOrEqualToThreshold |
| PreCondition |
string |
閾值比較符號。取值:
|
>= |
| Expression |
string |
觸發警示的規則描述。 說明
警示規則的主體,當監控資料滿足警示條件時,觸發警示規則。 |
$Average>=10 |
| Times |
integer |
警示重試次數。 |
1 |
| Tag |
string |
此參數已棄用,無需關注。 |
Deprecated: true |
| Threshold |
string |
警示閾值。 |
10 |
| Level |
integer |
警示的層級和通知方式。取值:
|
3 |
| ExpressionListJoin |
string |
多個監控項目之間的關係。取值:
|
&& |
| ExpressionList |
object |
||
| ExpressionList |
array<object> |
多指標警示規則描述。 |
|
|
object |
無。 |
||
| ComparisonOperator |
string |
警示層級的閾值比較運算子。取值:
|
GreaterThanOrEqualToThreshold |
| MetricName |
string |
監控項目名稱。 |
cpu_total |
| Period |
string |
監控項目的統計週期。單位:秒。預設為監控項目的原始上報週期。 |
60 |
| Statistics |
string |
警示層級的統計方法。取值:
|
Average |
| Threshold |
string |
警示閾值。 |
90 |
| ExpressionRaw |
string |
透過表達式建立的警示條件。包括但不限於以下情況:
|
$Average > ($instanceId == 'i-io8kfvcpp7x5****'? 80: 50) |
樣本
正常返回樣本
JSON格式
{
"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": "Deprecated: true",
"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)"
}
]
}
}
]
}
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | %s | %s | |
| 500 | %s | %s | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | %s | %s | |
| 404 | %s | %s | |
| 503 | %s | %s |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。