將警示範本套用至應用程式分組,產生警示規則。
介面說明
本文將提供一個範例,將警示範本700****套用至應用程式分組123456,產生警示規則的 ID 為applyTemplate8ab74c6b-9f27-47ab-8841-de01dc08****,名稱為test123。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
cms:ApplyMetricRuleTemplate |
create |
*MetricRuleTemplate
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| SilenceTime |
integer |
否 |
通道靜默週期。單位:秒。預設值:86400。 說明
當監控資料持續超過警示規則閾值時,每個靜默週期內只傳送一次警示通知。 |
86400 |
| GroupId |
integer |
是 |
應用程式分組 ID。 關於如何取得應用程式分組 ID,請參見 DescribeMonitorGroups 。 |
123456 |
| TemplateIds |
string |
是 |
警示範本 ID。 關於如何取得警示範本 ID,請參見 DescribeMetricRuleTemplateList 。 |
700**** |
| EnableStartTime |
integer |
否 |
警示生效的開始時間(小時)。格式為兩位數字字串(如 "00"、"09"、"23"),取值範圍為 00~23,代表 00:00 至 23:00。時區預設為 UTC+8(北京時間)。 |
00 |
| EnableEndTime |
integer |
否 |
警示生效的結束時間(小時)。格式為兩位數字字串(如 "00"、"18"、"23"),取值範圍為 00~23。該值表示結束時間所在的小時,實際生效截止至該小時的 59 分(例如 "23" 表示生效至 23:59)。時區預設為 UTC+8(北京時間)。 |
23 |
| NotifyLevel |
integer |
否 |
警示通知方式。取值: 4:旺旺+釘釘機器人。 |
4 |
| ApplyMode |
string |
否 |
範本套用方式。取值:
|
GROUP_INSTANCE_FIRST |
| Webhook |
string |
否 |
警示發生時會回呼指定的 URL 位址並傳送 POST 請求。 |
https://www.aliyun.com |
| AppendMode |
string |
否 |
範本套用策略。取值:
|
all |
關於公用請求參數的詳情,請參見公用參數。
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| Code |
integer |
狀態碼。 說明
200 表示成功。 |
200 |
| Message |
string |
錯誤資訊。 |
The specified resource is not found. |
| RequestId |
string |
請求 ID。 |
3F897F3C-020A-4993-95B4-63ABB84F83E6 |
| Success |
boolean |
操作是否成功。取值:
|
true |
| Resource |
object |
警示規則影響的資源。 |
|
| GroupId |
integer |
應用程式分組 ID。 |
123456 |
| AlertResults |
array<object> |
產生警示規則的詳細結果。 |
|
|
object |
產生警示規則的詳細結果。 |
||
| Code |
string |
狀態碼。 說明
200 表示成功。 |
200 |
| Message |
string |
返回訊息。 |
alert rule is creating, please wait a few minutes. |
| Success |
boolean |
操作是否成功。取值:
|
true |
| RuleName |
string |
警示規則名稱。 |
test123 |
| RuleId |
string |
警示規則 ID。 |
applyTemplate8ab74c6b-9f27-47ab-8841-de01dc08**** |
樣本
正常返回樣本
JSON格式
{
"Code": 200,
"Message": "The specified resource is not found.",
"RequestId": "3F897F3C-020A-4993-95B4-63ABB84F83E6",
"Success": true,
"Resource": {
"GroupId": 123456,
"AlertResults": [
{
"Code": "200",
"Message": "alert rule is creating, please wait a few minutes.",
"Success": true,
"RuleName": "test123",
"RuleId": "applyTemplate8ab74c6b-9f27-47ab-8841-de01dc08****"
}
]
}
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | ParameterInvalid | Illegal parameters. | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | AccessForbidden | User not authorized to operate on the specified resource. | |
| 404 | ResourceNotFound | %s |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。