ALIYUN::CMS::GroupMetricRule is used to create an alert rule for an application group.
Syntax
{
"Type": "ALIYUN::CMS::GroupMetricRule",
"Properties": {
"NoEffectiveInterval": String,
"SilenceTime": Integer,
"Category": String,
"RuleId": String,
"Dimensions": String,
"Period": Integer,
"EffectiveInterval": String,
"Namespace": String,
"GroupId": String,
"MetricName": String,
"Escalations": Map,
"EmailSubject": String,
"Webhook": String,
"RuleName": String,
"Interval": Integer
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
Category | String | Yes | No | The abbreviation of the service name. | Valid values:
Note More Alibaba Cloud services will be supported in the future. |
Escalations | Map | Yes | Yes | The alert settings. | For more information, see Escalations properties. |
GroupId | String | Yes | Yes | The ID of the application group. | None. |
MetricName | String | Yes | Yes | The name of the metric. For more information, see DescribeMetricMetaList or Major metrics of Alibaba Cloud services. | None. |
Namespace | String | Yes | No | The namespace of the service. For more information, see DescribeMetricMetaList or Major metrics of Alibaba Cloud services. | None. |
RuleId | String | Yes | No | The ID of the alert rule. | The ID is generated by the caller to ensure that the ID is unique. |
RuleName | String | Yes | Yes | The name of the alert rule. | None. |
Dimensions | String | No | Yes | The extended resource dimensions. | You can use this property to associate all instance-level resources that belong to an application group with the alert rule that is created for the application group. You can also use this property to associate lower-level resources with the alert rule. For example, if you want to associate the disk usage of root partitions of all instances that belong to the application group with the alert rule, specify |
EffectiveInterval | String | No | Yes | The period of time during which the alert rule takes effect. | None. |
EmailSubject | String | No | Yes | The subject of the alert notification email. | None. |
Interval | Integer | No | Yes | The interval at which CloudMonitor checks whether the alert rule is triggered. The default value is the lowest frequency at which the metric is polled. | Unit: seconds. We recommend that you set the interval to the data aggregation period. If the interval is shorter than the data aggregation period, alerts cannot be triggered due to insufficient data. |
NoEffectiveInterval | String | No | Yes | The period of time during which the alert rule does not take effect. | None. |
Period | Integer | No | Yes | The aggregation period of metric data. | The value is an integral multiple of 60. Unit: seconds. Default value: 300. Note For example, raw metric data is reported at an interval of 1 minute. If you set this property to 300, the average of the metric data reported over a period of 5 minutes is used to determine whether to trigger an alert. |
SilenceTime | Integer | No | Yes | The period of time during which you do not receive notifications but the triggered alert remains effective. | Unit: seconds. Minimum value: 3600. This value is equivalent to 1 hour. Default value: 86400. This value is equivalent to one day. |
Webhook | String | No | Yes | The webhook address to which a request is sent when an alert is triggered. | None. |
Escalations syntax
"Escalations": {
"Critical": Map,
"Info": Map,
"Warn": Map
}
Escalations properties
Property | Type | Required | Editable | Description | Constraint |
Critical | Map | No | Yes | The settings of critical-level alerts. | For more information, see Critical properties. |
Info | Map | No | Yes | The settings of info-level alerts. | For more information, see Info properties. |
Warn | Map | No | Yes | The settings of warn-level alerts. | For more information, see Warn properties. |
Critical syntax
"Critical": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": Integer
}
Critical properties
Property | Type | Required | Editable | Description | Constraint |
ComparisonOperator | String | Yes | Yes | The operator that is used to compare the metric value with the threshold. | Valid values:
|
Statistics | String | Yes | Yes | The method that is used to calculate the metric values based on which alerts are triggered. | For more information about the valid values of this property, see DescribeSystemEventMetaList. |
Times | Integer | Yes | Yes | The consecutive number of times for which the metric value meets the alert condition before an alert is triggered. | None. |
Threshold | Integer | Yes | Yes | The alert threshold. | None. |
Info syntax
"Info": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": Integer
}
Info properties
Property | Type | Required | Editable | Description | Constraint |
ComparisonOperator | String | Yes | Yes | The operator that is used to compare the metric value with the threshold. | Valid values:
|
Statistics | String | Yes | Yes | The method that is used to calculate the metric values based on which alerts are triggered. | For more information about the valid values of this property, see DescribeSystemEventMetaList. |
Threshold | Integer | Yes | Yes | The alert threshold. | None. |
Times | Integer | Yes | Yes | The consecutive number of times for which the metric value meets the alert condition before an alert is triggered. | None. |
Warn syntax
"Warn": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": Integer
}
Warn properties
Property | Type | Required | Editable | Description | Constraint |
ComparisonOperator | String | Yes | Yes | The operator that is used to compare the metric value with the threshold. | Valid values:
|
Statistics | String | Yes | Yes | The method that is used to calculate the metric values based on which alerts are triggered. | For more information about the valid values of this property, see DescribeSystemEventMetaList. |
Threshold | Integer | Yes | Yes | The alert threshold. | None. |
Times | Integer | Yes | Yes | The consecutive number of times for which the metric value meets the alert condition before an alert is triggered. | None. |
Return values
Fn::GetAtt
RuleId: the ID of the alert rule.
Examples
YAML
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Category:
Type: String
Description: |-
The abbreviation of the service name. Valid values:
ecs (including Alibaba Cloud and non-Alibaba Cloud hosts)
rds (ApsaraDB for RDS)
ads (AnalyticDB)
slb (Server Load Balancer)
vpc (Virtual Private Cloud)
apigateway (API Gateway)
cdn
cs (Container Service for Swarm)
dcdm (Dynamic Route for CDN)
ddos (distributed denial of service)
eip (Elastic IP)
elasticsearch (Elasticsearch)
emr (E-MapReduce)
ess (Auto Scaling)
hbase (ApsaraDB for HBase)
iot_edge (IoT Edge)
k8s_pod (k8s pod)
kvstore_sharding (ApsaraDB for Redis cluster version)
kvstore_splitrw (ApsaraDB for Redis read/write splitting version)
kvstore_standard (ApsaraDB for Redis standard version)
memcache (ApsaraDB for Memcache)
mns (Message Service)
mongodb (ApsaraDB for MongoDB replica set instances)
mongodb_cluster (ApsaraDB for MongoDB cluster version)
mongodb_sharding (ApsaraDB for MongoDB sharded clusters)
mq_topic (Message Service topic)
ocs (original version of ApsaraDB for Memcache)
opensearch (Open Search)
oss (Object Storage Service)
polardb (ApsaraDB for POLARDB)
petadata (HybridDB for MySQL)
scdn (Secure Content Delivery Network)
sharebandwidthpackages (shared bandwidth package)
sls (Log Service)
vpn (VPN Gateway)
Default: ecs
RuleId:
Type: String
Description: |-
The ID of the alert rule. The IDs of alert rules are generated by callers to ensure
uniqueness.
Default: uuid_aad57415dswer23124sfsg9***
Namespace:
Type: String
Description: |-
The data namespace of the service. For more information, call DescribeMetricMetaList
or see Preset metrics reference.
Default: acs_ecs_dashboard
GroupId:
Type: String
Description: The ID of application group.
Default: 6102***
MetricName:
Type: String
Description: The name of the metric. For more information, call DescribeMetricMetaList or see Preset metrics reference.
Default: cpu_cores
Escalations:
Type: Json
Description: Alarm configuration.
Default:
Critical:
ComparisonOperator: GreaterThanOrEqualToThreshold
Times: 3
Statistics: Value
Threshold: '100'
RuleName:
Type: String
Description: The name of the alert rule.
Default: mytest
Resources:
GroupMetricRule:
Type: ALIYUN::CMS::GroupMetricRule
Properties:
Category:
Ref: Category
RuleId:
Ref: RuleId
Namespace:
Ref: Namespace
GroupId:
Ref: GroupId
MetricName:
Ref: MetricName
Escalations:
Ref: Escalations
RuleName:
Ref: RuleName
Outputs:
RuleId:
Description: Rule ID.
Value:
Fn::GetAtt:
- GroupMetricRule
- RuleId
JSON
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Category": {
"Type": "String",
"Description": "The abbreviation of the service name. Valid values:\necs (including Alibaba Cloud and non-Alibaba Cloud hosts)\nrds (ApsaraDB for RDS)\nads (AnalyticDB)\nslb (Server Load Balancer)\nvpc (Virtual Private Cloud)\napigateway (API Gateway)\ncdn\ncs (Container Service for Swarm)\ndcdm (Dynamic Route for CDN)\nddos (distributed denial of service)\neip (Elastic IP)\nelasticsearch (Elasticsearch)\nemr (E-MapReduce)\ness (Auto Scaling)\nhbase (ApsaraDB for HBase)\niot_edge (IoT Edge)\nk8s_pod (k8s pod)\nkvstore_sharding (ApsaraDB for Redis cluster version)\nkvstore_splitrw (ApsaraDB for Redis read/write splitting version)\nkvstore_standard (ApsaraDB for Redis standard version)\nmemcache (ApsaraDB for Memcache)\nmns (Message Service)\nmongodb (ApsaraDB for MongoDB replica set instances)\nmongodb_cluster (ApsaraDB for MongoDB cluster version)\nmongodb_sharding (ApsaraDB for MongoDB sharded clusters)\nmq_topic (Message Service topic)\nocs (original version of ApsaraDB for Memcache)\nopensearch (Open Search)\noss (Object Storage Service)\npolardb (ApsaraDB for POLARDB)\npetadata (HybridDB for MySQL)\nscdn (Secure Content Delivery Network)\nsharebandwidthpackages (shared bandwidth package)\nsls (Log Service)\nvpn (VPN Gateway)",
"Default": "ecs"
},
"RuleId": {
"Type": "String",
"Description": "The ID of the alert rule. The IDs of alert rules are generated by callers to ensure\nuniqueness.",
"Default": "uuid_aad57415dswer23124sfsg9***"
},
"Namespace": {
"Type": "String",
"Description": "The data namespace of the service. For more information, call DescribeMetricMetaList\nor see Preset metrics reference.",
"Default": "acs_ecs_dashboard"
},
"GroupId": {
"Type": "String",
"Description": "The ID of application group.",
"Default": "6102***"
},
"MetricName": {
"Type": "String",
"Description": "The name of the metric. For more information, call DescribeMetricMetaList or see Preset metrics reference.",
"Default": "cpu_cores"
},
"Escalations": {
"Type": "Json",
"Description": "Alarm configuration.",
"Default": {
"Critical": {
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Times": 3,
"Statistics": "Value",
"Threshold": "100"
}
}
},
"RuleName": {
"Type": "String",
"Description": "The name of the alert rule.",
"Default": "mytest"
}
},
"Resources": {
"GroupMetricRule": {
"Type": "ALIYUN::CMS::GroupMetricRule",
"Properties": {
"Category": {
"Ref": "Category"
},
"RuleId": {
"Ref": "RuleId"
},
"Namespace": {
"Ref": "Namespace"
},
"GroupId": {
"Ref": "GroupId"
},
"MetricName": {
"Ref": "MetricName"
},
"Escalations": {
"Ref": "Escalations"
},
"RuleName": {
"Ref": "RuleName"
}
}
}
},
"Outputs": {
"RuleId": {
"Description": "Rule ID.",
"Value": {
"Fn::GetAtt": [
"GroupMetricRule",
"RuleId"
]
}
}
}
}