ALIYUN::CMS::MetricRuleTargets is used to add or modify one or more message resources for an alert rule.
Syntax
{
"Type": "ALIYUN::CMS::MetricRuleTargets",
"Properties": {
"RuleId": String,
"Targets": List
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
RuleId | String | Yes | No | The ID of the alert rule. | None |
Targets | List | Yes | No | The message resources of the alert rule. | You can specify up to five message resources. For more information, see Targets properties. |
Targets syntax
"Targets": [
{
"Level": String,
"Id": String,
"Arn": String
}
]
Targets properties
Property | Type | Required | Editable | Description | Constraint |
Arn | String | Yes | No | The Alibaba Cloud Resource Name (ARN) of the message resource. | The ARN must be in the following format:
|
Id | String | Yes | No | The ID of the message resource. | The ID must be unique in the alert rule. |
Level | String | No | No | The alert level. | Valid values:
|
Return values
Fn::GetAtt
Arns: the ARNs of the message resources.
Ids: the IDs of the message resources.
Examples
YAML
format
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
RuleId:
Type: String
Description: The ID of the alert rule.
TopicArn:
Type: String
Description: Resource description
Default: acs:mns:cn-hangzhou:111:/queues/test
Resources:
MetricRuleTargets:
Type: ALIYUN::CMS::MetricRuleTargets
Properties:
RuleId:
Ref: RuleId
Targets:
- Level: WARN
Id: '1'
Arn:
Fn::Sub:
- ${TopicArn}/message
- TopicArn:
Ref: TopicArn
JSON
format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"RuleId": {
"Type": "String",
"Description": "The ID of the alert rule."
},
"TopicArn": {
"Type": "String",
"Description": "Resource description",
"Default": "acs:mns:cn-hangzhou:111:/queues/test"
}
},
"Resources": {
"MetricRuleTargets": {
"Type": "ALIYUN::CMS::MetricRuleTargets",
"Properties": {
"RuleId": {
"Ref": "RuleId"
},
"Targets": [
{
"Level": "WARN",
"Id": "1",
"Arn": {
"Fn::Sub": [
"${TopicArn}/message",
{
"TopicArn": {
"Ref": "TopicArn"
}
}
]
}
}
]
}
}
}
}