ALIYUN::ESS::AlarmTask類型用於建立監控項警示任務。
文法
{
"Type": "ALIYUN::ESS::AlarmTask",
"Properties": {
"Statistics": String,
"Name": String,
"EvaluationCount": Integer,
"Period": Integer,
"MetricType": String,
"ComparisonOperator": String,
"Dimensions": List,
"ScalingGroupId": String,
"AlarmAction": List,
"Threshold": Number,
"MetricName": String,
"GroupId": Integer,
"Description": String
}
}屬性
| 屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
| Statistics | String | 否 | 否 | 統計方法,必須與定義的metric一致,例如Average。 | 可選值:Average、Minimum、Maximum。 |
| Name | String | 否 | 是 | 警示規則名稱。 | 無 |
| EvaluationCount | Integer | 否 | 否 | 連續探測幾次都滿足閾值條件時警示,預設3次。 | 最小為1。 |
| Period | Integer | 否 | 否 | 查詢指標的周期,必須與定義的metric一致,預設300,單位為秒 | 可用值:60、120、300、900。 |
| MetricType | String | 否 | 否 | 標準類型。 | 可用值:system、custom。 |
| ComparisonOperator | String | 否 | 否 | 警示比較符。 | 只能為以下幾種<=、<、>、>=。 |
| Dimensions | List | 否 | 否 | 警示規則對應執行個體列表。 | 最少一個。 |
| ScalingGroupId | String | 是 | 否 | 伸縮組ID。 | 無 |
| AlarmAction | List | 是 | 是 | 警示動作列表。 | 最少1個,最多5個。 |
| Threshold | Number | 是 | 否 | 警示閾值,目前只開放數實值型別功能。 | 無 |
| MetricName | String | 是 | 否 | 相應產品對應的監控項名稱,參考各產品metric定義。 | 無 |
| GroupId | Integer | 否 | 否 | 組ID。 | 無 |
| Description | String | 否 | 是 | 描述。 | 無 |
Dimensions文法
"Dimensions": [
{
"DimensionKey": String,
"DimensionValue": String
}
]Dimensions屬性
| 屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
| DimensionValue | String | 是 | 否 | 監控項關聯的維度資訊值。 | 無 |
| DimensionKey | String | 是 | 否 | 監控項關聯的維度資訊鍵。 | 無 |
傳回值
Fn::GetAtt
AlarmTaskId:警示任務ID。
樣本
JSON格式{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { "AutoScalingGroupId": { "Type": "String", "AssociationProperty": "ALIYUN::ESS::AutoScalingGroup::AutoScalingGroupId" }, "AlarmAction": { "Type": "CommaDelimitedList", "Description": "Alarm Actions", "MinLength": 1, "MaxLength": 5 } }, "Resources": { "AlarmTask": { "Type": "ALIYUN::ESS::AlarmTask", "Properties": { "ScalingGroupId": { "Ref": "AutoScalingGroupId" }, "AlarmAction": [ "ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****" ], "Threshold": 1, "MetricName": "TestMetric", "MetricType": "custom", "Statistics": "Average" } } }, "Outputs": { "AlarmTaskId": { "Description": "The alarm task ID", "Value": { "Fn::GetAtt": [ "AlarmTask", "AlarmTaskId" ] } } } }