All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::CMS::GroupMetricRule

Last Updated:Aug 22, 2023

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

NoEffectiveInterval

String

No

Yes

The time period during which the alert rule does not take effect.

None

SilenceTime

Integer

No

Yes

The time period during which you do not receive notifications but the triggered alert remains effective.

Unit: seconds.

Minimum value: 3600. This value is equivalent to one hour.

Default value: 86400. This value is equivalent to one day.

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: Dynamic Route for CDN (DCDN)

  • ddos: Anti-DDoS Pro and Anti-DDoS Premium

  • eip: Elastic IP Address (EIP)

  • elasticsearch: Elasticsearch

  • emr: E-MapReduce (EMR)

  • ess: Auto Scaling (ESS)

  • hbase: ApsaraDB for HBase

  • iot_edge: IoT Edge

  • k8s_pod: pods in ACK

  • kvstore_sharding: ApsaraDB for Redis that uses the cluster master-replica architecture

  • kvstore_splitrw: ApsaraDB for Redis that uses the read/write splitting architecture

  • kvstore_standard: ApsaraDB for Redis that uses the standard master-replica architecture

  • memcache: ApsaraDB for Memcache

  • mns: Message Service (MNS)

  • mongodb: ApsaraDB for MongoDB that uses the replica set architecture

  • ApsaraDB for MongoDB that uses the standalone architecture

  • mongodb_sharding: ApsaraDB for MongoDB that uses the sharded cluster architecture

  • mq_topic: MNS topics

  • ocs: ApsaraDB for Memcache (OCS)

  • opensearch: Open Search

  • oss: Object Storage Service (OSS)

  • polardb: PolarDB

  • petadata: HybridDB for MySQL

  • scdn: Secure CDN (SCDN)

  • sharebandwidthpackages: Internet Shared Bandwidth

  • sls: Log Service

  • vpn: VPN Gateway

Note

More Alibaba Cloud services are to be supported in the future.

RuleId

String

Yes

No

The ID of the alert rule.

The rule ID is generated by the caller to make sure that it is unique.

Dimensions

String

No

Yes

The expended resource dimensions.

This parameter associates all instances in the application group with the alert rule. You can set this parameter to associate lower-level resources with the alert rule. For example, if you need to associate the disk usage of root partitions of all instances in the application group with the alert rule, set this parameter to [ {"dskName":"/"} ].

Period

Integer

No

Yes

The aggregation period of monitoring data.

The value is an integral multiple of 60.

Unit: seconds.

Default value: 300.

Note

Assume that raw monitoring data is reported at an interval of 1 minute. If you set this parameter to 300, the average of the 5-minute monitoring data is used to determine whether to trigger an alert.

EffectiveInterval

String

No

Yes

The time period during which the alert rule is effective.

None

Namespace

String

Yes

No

The namespace of the service. For more information, see DescribeMetricMetaList or Major metrics of Alibaba Cloud services.

None

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

Escalations

Map

Yes

Yes

The alert settings.

For more information, see the Escalations properties section.

EmailSubject

String

No

Yes

The subject of the alert notification email.

None

Webhook

String

No

Yes

The webhook address to which a request is sent when an alert is triggered.

None

RuleName

String

Yes

Yes

The name of the alert rule.

None

Interval

Integer

No

Yes

The interval at which Cloud Monitor 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 this interval to the data aggregation period. If this interval is shorter than the data aggregation period, alerts cannot be triggered due to insufficient data.

Escalations syntax

"Escalations": {
  "Critical": Map,
  "Info": Map,
  "Warn": Map
}

Escalations properties

Property

Type

Required

Editable

Description

Constraint

Critical

Map

No

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": Integer
}

Critical properties

Property

Type

Required

Editable

Description

Constraint

ComparisonOperator

String

Yes

Yes

The comparison operator of the threshold for critical-level alerts.

Valid values:

  • GreaterThanOrEqualToThreshold

  • GreaterThanThreshold

  • LessThanOrEqualToThreshold

  • LessThanThreshold

  • NotEqualToThreshold

  • GreaterThanYesterday

  • LessThanYesterday

  • GreaterThanLastWeek

  • LessThanLastWeek

  • GreaterThanLastPeriod

  • LessThanLastPeriod

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.

For more information about the statistical methods for alerts of different levels, see DescribeSystemEventMetaList.

Threshold

Integer

Yes

Yes

The threshold for critical-level alerts.

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 comparison operator of the threshold for info-level alerts.

Valid values:

  • GreaterThanOrEqualToThreshold

  • GreaterThanThreshold

  • LessThanOrEqualToThreshold

  • LessThanThreshold

  • NotEqualToThreshold

  • GreaterThanYesterday

  • LessThanYesterday

  • GreaterThanLastWeek

  • LessThanLastWeek

  • GreaterThanLastPeriod

  • LessThanLastPeriod

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.

For more information about the statistical methods for alerts of different levels, see DescribeSystemEventMetaList.

Threshold

Integer

Yes

Yes

The threshold for info-level alerts.

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 comparison operator of the threshold for warn-level alerts.

Valid values:

  • GreaterThanOrEqualToThreshold

  • GreaterThanThreshold

  • LessThanOrEqualToThreshold

  • LessThanThreshold

  • NotEqualToThreshold

  • GreaterThanYesterday

  • LessThanYesterday

  • GreaterThanLastWeek

  • LessThanLastWeek

  • GreaterThanLastPeriod

  • LessThanLastPeriod

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.

For more information about the statistical methods for alerts of different levels, see DescribeSystemEventMetaList.

Threshold

Integer

Yes

Yes

The threshold for warn-level alerts.

None

Response parameters

Fn::GetAtt

RuleId: the ID of the alert rule.

Examples

YAML format

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 format

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