All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::CMS::GroupMetricRule

Last Updated:Mar 03, 2025

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:

  • ecs: Elastic Compute Service (ECS).

  • rds: ApsaraDB RDS.

  • ads: AnalyticDB for MySQL.

  • slb: Server Load Balancer (SLB).

  • vpc: Virtual Private Cloud (VPC).

  • apigateway: API Gateway.

  • cdn: Alibaba Cloud CDN (CDN).

  • cs: Container Service for Kubernetes (ACK).

  • dcdn: Edge Security Acceleration (ESA).

  • ddos: Anti-DDoS Proxy.

  • eip: Elastic IP Address (EIP).

  • elasticsearch: Elasticsearch.

  • emr: E-MapReduce (EMR).

  • ess: Auto Scaling.

  • hbase: ApsaraDB for HBase.

  • iot_edge: Link IoT Edge.

  • k8s_pod: ACK pod.

  • kvstore_sharding: Tair (Redis OSS-compatible) of the cluster architecture.

  • kvstore_splitrw: Tair (Redis OSS-compatible) of the read/write splitting architecture.

  • kvstore_standard: Tair (Redis OSS-compatible) of the standard architecture.

  • memcache: ApsaraDB for Memcache of the new version.

  • SMQ: Simple Message Queue (formerly MNS) (SMQ).

  • mongodb: ApsaraDB for MongoDB replica set instance.

  • mongodb_cluster: ApsaraDB for MongoDB standalone instance.

  • mongodb_sharding: ApsaraDB for MongoDB sharded cluster instance.

  • mq_topic: SMQ topic.

  • ocs: ApsaraDB for Memcache of the earlier version.

  • opensearch: OpenSearch.

  • oss: Object Storage Service (OSS).

  • polardb: PolarDB.

  • petadata: HybridDB for MySQL.

  • sharebandwidthpackages: Internet Shared Bandwidth instance.

  • sls: Simple Log Service (SLS).

  • vpn: VPN Gateway.

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 [ {"dskName":"/"} ] as the value of this property.

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:

  • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.

  • GreaterThanThreshold: greater than the threshold.

  • LessThanOrEqualToThreshold: less than or equal to the threshold.

  • LessThanThreshold: less than the threshold.

  • NotEqualToThreshold: not equal to the threshold.

  • GreaterThanYesterday: greater than the metric value at the same time yesterday.

  • LessThanYesterday: less than the metric value at the same time yesterday.

  • GreaterThanLastWeek: greater than the metric value at the same time in the previous week.

  • LessThanLastWeek: less than the metric value at the same time in the previous week.

  • GreaterThanLastPeriod: greater than the metric value in the previous monitoring cycle.

  • LessThanLastPeriod: less than the metric value in the previous monitoring cycle.

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:

  • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.

  • GreaterThanThreshold: greater than the threshold.

  • LessThanOrEqualToThreshold: less than or equal to the threshold.

  • LessThanThreshold: less than the threshold.

  • NotEqualToThreshold: not equal to the threshold.

  • GreaterThanYesterday: greater than the metric value at the same time yesterday.

  • LessThanYesterday: less than the metric value at the same time yesterday.

  • GreaterThanLastWeek: greater than the metric value at the same time in the previous week.

  • LessThanLastWeek: less than the metric value at the same time in the previous week.

  • GreaterThanLastPeriod: greater than the metric value in the previous monitoring cycle.

  • LessThanLastPeriod: less than the metric value in the previous monitoring cycle.

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:

  • GreaterThanOrEqualToThreshold: greater than or equal to the threshold.

  • GreaterThanThreshold: greater than the threshold.

  • LessThanOrEqualToThreshold: less than or equal to the threshold.

  • LessThanThreshold: less than the threshold.

  • NotEqualToThreshold: not equal to the threshold.

  • GreaterThanYesterday: greater than the metric value at the same time yesterday.

  • LessThanYesterday: less than the metric value at the same time yesterday.

  • GreaterThanLastWeek: greater than the metric value at the same time in the previous week.

  • LessThanLastWeek: less than the metric value at the same time in the previous week.

  • GreaterThanLastPeriod: greater than the metric value in the previous monitoring cycle.

  • LessThanLastPeriod: less than the metric value in the previous monitoring cycle.

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"
        ]
      }
    }
  }
}