ALIYUN::CMS::MetricRuleTemplate类型用于创建报警模板。
语法
{
"Type": "ALIYUN::CMS::MetricRuleTemplate",
"Properties": {
"AlertTemplates": List,
"Description": String,
"RestVersion": Integer,
"TemplateId": Integer,
"Name": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
AlertTemplates | List | 否 | 是 | 报警模板。 | 最多添加200个规则。
更多信息,请参见AlertTemplates属性。 |
Description | String | 否 | 是 | 报警模板描述信息。 | 无 |
RestVersion | Integer | 否 | 否 | 报警模板版本。 | 默认值为0。 |
TemplateId | Integer | 否 | 否 | 克隆模板ID。 | 无 |
Name | String | 是 | 否 | 报警模板名称。 | 无 |
AlertTemplates语法
"AlertTemplates": [
{
"MetricName": String,
"Category": String,
"Escalations": Map,
"Period": Integer,
"Webhook": String,
"Namespace": String,
"RuleName": String,
"Selector": String
}
]
AlertTemplates属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
MetricName | String | 是 | 是 | 监控项名称。 | 无 |
Category | String | 是 | 是 | 产品名称或产品规格缩写。 | 取值:
|
Escalations | Map | 否 | 否 | 报警配置。 | 更多信息,请参见Escalations属性。 |
Period | Integer | 否 | 是 | 监控数据的聚合周期。 | 默认为监控项对应的最小频率,通常不需要指定。
单位:秒。 |
Webhook | String | 否 | 否 | 报警发生时的回调URL地址。 | 无 |
Namespace | String | 是 | 是 | 产品的数据命名空间。 | 更多信息,请参见DescribeMetricMetaList或监控项使用说明。 |
RuleName | String | 是 | 是 | 报警规则的名称。 | 无 |
Selector | String | 否 | 是 | 扩展字段选项。 | 无 |
Escalations语法
"Escalations": {
"Critical": Map,
"Info": Map,
"Warn": Map
}
Escalations属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
Critical | Map | 是 | 是 | Critical级别报警设置。 | 更多信息,请参见Critical属性。 |
Info | Map | 否 | 是 | Info级别报警设置。 | 更多信息,请参见Info属性。 |
Warn | Map | 否 | 是 | Warn级别报警设置。 | 更多信息,请参见Warn属性。 |
Critical语法
"Critical": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}
Critical属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
ComparisonOperator | String | 是 | 是 | 阈值比较符。 | 取值:
|
Times | Integer | 是 | 是 | 报警重试次数。 | 无 |
Statistics | String | 是 | 是 | 报警统计方法。 | 无 |
Threshold | String | 是 | 是 | 报警阈值。 | 无 |
Info语法
"Info": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}
Info属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
ComparisonOperator | String | 是 | 是 | 阈值比较符。 | 取值:
|
Times | Integer | 是 | 是 | 报警重试次数。 | 无 |
Statistics | String | 是 | 是 | 报警统计方法。 | 无 |
Threshold | String | 是 | 是 | 报警阈值。 | 无 |
Warn语法
"Warn": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}
Warn属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
ComparisonOperator | String | 是 | 是 | 阈值比较符。 | 取值:
|
Times | Integer | 是 | 是 | 报警重试次数。 | 无 |
Statistics | String | 是 | 是 | 报警统计方法。 | 无 |
Threshold | String | 是 | 是 | 报警阈值。 | 无 |
返回值
Fn::GetAtt
Id:报警模板ID。
示例
JSON
格式
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"AlertTemplates": {
"Type": "Json",
"Description": "Valid values of N: 0 to 200.",
"MinLength": 0,
"MaxLength": 200
},
"Description": {
"Type": "String",
"Description": "The description of the alert template."
},
"RestVersion": {
"Type": "Number",
"Description": "The version of the alert template. Call DescribeMetricRuleTemplateList or DescribeMetricRuleTemplateAttribute\nto obtain information about the alert templates. The combination of version and ID\nuniquely identifies an alert template."
},
"TemplateId": {
"Type": "Number",
"Description": "The ID of the alert template."
},
"Name": {
"Type": "String",
"Description": "The name of the alert template."
}
},
"Resources": {
"MetricRuleTemplate": {
"Type": "ALIYUN::CMS::MetricRuleTemplate",
"Properties": {
"AlertTemplates": {
"Ref": "AlertTemplates"
},
"Description": {
"Ref": "Description"
},
"RestVersion": {
"Ref": "RestVersion"
},
"TemplateId": {
"Ref": "TemplateId"
},
"Name": {
"Ref": "Name"
}
}
}
},
"Outputs": {
"Id": {
"Description": "Alarm template ID.",
"Value": {
"Fn::GetAtt": [
"MetricRuleTemplate",
"Id"
]
}
}
}
}
YAML
格式
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
AlertTemplates:
Type: Json
Description: 'Valid values of N: 0 to 200.'
MinLength: 0
MaxLength: 200
Description:
Type: String
Description: The description of the alert template.
RestVersion:
Type: Number
Description: >-
The version of the alert template. Call DescribeMetricRuleTemplateList or
DescribeMetricRuleTemplateAttribute
to obtain information about the alert templates. The combination of
version and ID
uniquely identifies an alert template.
TemplateId:
Type: Number
Description: The ID of the alert template.
Name:
Type: String
Description: The name of the alert template.
Resources:
MetricRuleTemplate:
Type: 'ALIYUN::CMS::MetricRuleTemplate'
Properties:
AlertTemplates:
Ref: AlertTemplates
Description:
Ref: Description
RestVersion:
Ref: RestVersion
TemplateId:
Ref: TemplateId
Name:
Ref: Name
Outputs:
Id:
Description: Alarm template ID.
Value:
'Fn::GetAtt':
- MetricRuleTemplate
- Id