ALIYUN::CMS::MetricRuleTemplate is used to create an alert template.
Syntax
{
"Type": "ALIYUN::CMS::MetricRuleTemplate",
"Properties": {
"AlertTemplates": List,
"Description": String,
"RestVersion": Integer,
"TemplateId": Integer,
"Name": String
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
AlertTemplates | List | No | Yes | The details of alert rules that are generated based on the alert template. | A maximum of 200 alert rules can be specified.
For more information, see the AlertTemplates properties section. |
Description | String | No | Yes | The description of the alert template. | None |
RestVersion | Integer | No | No | The version of the alert template. | Default value: 0. |
TemplateId | Integer | No | No | The ID of the template to be cloned. | None |
Name | String | Yes | No | The name of the alert template. | None |
AlertTemplates syntax
"AlertTemplates": [
{
"MetricName": String,
"Category": String,
"Escalations": Map,
"Period": Integer,
"Webhook": String,
"Namespace": String,
"RuleName": String,
"Selector": String
}
]
AlertTemplates properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
MetricName | String | Yes | Yes | The name of the metric. | None |
Category | String | Yes | Yes | The abbreviation of the service name. | Valid values:
|
Escalations | Map | No | No | The alert settings. | For more information, see the Escalations properties section. |
Period | Integer | No | Yes | The aggregation period of monitoring data. | The default value is the lowest frequency at which the metric is polled. Typically,
you do not need to specify the aggregation period.
Unit: seconds. |
Webhook | String | No | No | The webhook address to which a request is sent when an alert is triggered. | None |
Namespace | String | Yes | Yes | The namespace of the service. | For more information, see DescribeMetricMetaList or Instructions. |
RuleName | String | Yes | Yes | The name of the alert rule. | None |
Selector | String | No | Yes | The extended field selectors. | None |
Escalations syntax
"Escalations": {
"Critical": Map,
"Info": Map,
"Warn": Map
}
Escalations properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Critical | Map | Yes | Yes | The settings for critical-level alerts. | For more information, see the Critical properties section. |
Info | Map | No | Yes | The settings for info-level alerts. | For more information, see the Info properties section. |
Warn | Map | No | Yes | The settings for warn-level alerts. | For more information, see the Warn properties section. |
Critical syntax
"Critical": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}
Critical properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
ComparisonOperator | String | Yes | Yes | The comparison operator of the threshold for critical-level alerts. | Valid values:
|
Times | Integer | Yes | Yes | The number of times for which the metric value must exceed the threshold consecutively before a critical-level alert is triggered. | None |
Statistics | String | Yes | Yes | The statistical method for critical-level alerts. | None |
Threshold | String | Yes | Yes | The threshold for critical-level alerts. | None |
Info syntax
"Info": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}
Info properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
ComparisonOperator | String | Yes | Yes | The comparison operator of the threshold for info-level alerts. | Valid values:
|
Times | Integer | Yes | Yes | The number of times for which the metric value must exceed the threshold consecutively before an info-level alert is triggered. | None |
Statistics | String | Yes | Yes | The statistical method for info-level alerts. | None |
Threshold | String | Yes | Yes | The threshold for info-level alerts. | None |
Warn syntax
"Warn": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}
Warn properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
ComparisonOperator | String | Yes | Yes | The comparison operator of the threshold for warn-level alerts. | Valid values:
|
Times | Integer | Yes | Yes | The number of times for which the metric value must exceed the threshold consecutively before a warn-level alert is triggered. | None |
Statistics | String | Yes | Yes | The statistical method for warn-level alerts. | None |
Threshold | String | Yes | Yes | The threshold for warn-level alerts. | None |
Response parameters
Fn::GetAtt
Id: the ID of the alert template.
Examples
JSON
format
{
"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
format
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