All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::CMS::GroupMetricRule

Last Updated:Aug 13, 2024

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 MySQLAnalyticDB 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 Content Delivery Network (DCDN)

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

  • 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: pods in ACK

  • kvstore_sharding: ApsaraDB for Redis (Cluster Architecture)

  • kvstore_splitrw: ApsaraDB for Redis (Read/Write Splitting Architecture)

  • kvstore_standard: ApsaraDB for Redis (Standard Architecture)

  • memcache: ApsaraDB for Memcache (OCS, New Version)

  • mns: Message Service (MNS)

  • mongodb: ApsaraDB for MongoDB (Replica Set Architecture)

  • mongodb_cluster: ApsaraDB for MongoDB (Standalone Architecture)

  • mongodb_sharding: ApsaraDB for MongoDB (Sharded Cluster Architecture)

  • mq_topic: MNS topic

  • ocs: ApsaraDB for Memcache (OCS, Old Version)

  • opensearch: OpenSearch

  • oss: Object Storage Service (OSS)

  • polardb: PolarDB

  • petadata: HybridDB for MySQL

  • scdn: Secure CDN (SCDN)

  • sharebandwidthpackages: EIP Bandwidth Plan

  • sls: Simple Log Service

  • vpn: VPN Gateway

Note

More Alibaba Cloud services are to 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 cloud 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 rule ID is generated by the caller to ensure that it is unique.

RuleName

String

Yes

Yes

The name of the alert rule.

None

Dimensions

String

No

Yes

The extended resource dimensions.

This parameter associates all instances in the application group with the alert rule. You can specify 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 the value to [ {"dskName":"/"} ].

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 the 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 parameter to 300, the average of the 5-minute metric data 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 for critical-level alerts.

For more information, see Critical properties.

Info

Map

No

Yes

The settings for info-level alerts.

For more information, see Info properties.

Warn

Map

No

Yes

The settings for 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 comparison operator of 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 last week.

  • LessThanLastWeek: less than the metric value at the same time last 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 used to calculate the metric value based on which alerts are triggered.

You can call the DescribeSystemEventMetaList operation to query the valid values of this parameter.

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 comparison operator of 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 last week.

  • LessThanLastWeek: less than the metric value at the same time last 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 used to calculate the metric value based on which alerts are triggered.

You can call the DescribeSystemEventMetaList operation to query the valid values of this parameter.

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 comparison operator of 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 last week.

  • LessThanLastWeek: less than the metric value at the same time last 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 used to calculate the metric value based on which alerts are triggered.

You can call the DescribeSystemEventMetaList operation to query the valid values of this parameter.

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