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 name of the service to which the instances in the application group belong. Valid values:
  • ecs: Elastic Compute Service (ECS)
  • rds: ApsaraDB for RDS
  • ads: AnalyticDB for MySQL
  • slb: Server Load Balancer (SLB)
  • vpc: Virtual Private Cloud (VPC)
  • apigateway: API Gateway
  • cdn: Alibaba Cloud Content Delivery Network (CDN)
  • cs: Container Service for Kubernetes
  • dcdn: Dynamic Route for CDN
  • 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: IoT Edge
  • k8s_pod: pods in Container Service for Kubernetes
  • kvstore_sharding: ApsaraDB for Redis of the cluster master-replica architecture
  • kvstore_splitrw: ApsaraDB for Redis of the read/write splitting architecture
  • kvstore_standard: ApsaraDB for Redis of the standard master-replica architecture
  • memcache: ApsaraDB for Memcache
  • mns: Message Service (MNS)
  • mongodb: ApsaraDB for MongoDB of the replica set architecture
  • mongodb_cluster: ApsaraDB for MongoDB of the standalone architecture
  • mongodb_sharding: ApsaraDB for MongoDB of the sharded cluster architecture
  • mq_topic: MNS topics
  • ocs: ApsaraDB for Memcache of earlier versions
  • opensearch: Open Search
  • oss: Object Storage Service (OSS)
  • polardb: PolarDB
  • petadata: HybridDB for MySQL
  • scdn: Secure Content Delivery Network (SCDN)
  • sharebandwidthpackages: EIP Bandwidth Plan
  • sls: Log Service
  • vpn: VPN Gateway
Note More Alibaba Cloud services will 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 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 Escalations properties.
EmailSubject String No Yes The subject of the alert notification email. None
Webhook String No Yes The callback URL 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 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

"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 an 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 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 an 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

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "NoEffectiveInterval": {
      "Type": "String",
      "Description": "The period when the alert rule is ineffective."
    },
    "SilenceTime": {
      "Type": "Number",
      "Description": "The duration of the mute period during which new alerts are not sent even if the trigger\nconditions are met. Unit: second. Default value: 86400. Minimum value: 60.",
      "MinValue": 60
    },
    "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)\nDCDN (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)"
    },
    "RuleId": {
      "Type": "String",
      "Description": "The ID of the alert rule. The IDs of alert rules are generated by callers to ensure\nuniqueness."
    },
    "Dimensions": {
      "Type": "String",
      "Description": "The expended resource dimensions."
    },
    "Period": {
      "Type": "Number",
      "Description": "The aggregation period. Unite: second."
    },
    "EffectiveInterval": {
      "Type": "String",
      "Description": "The period when the alert rule is effective."
    },
    "Namespace": {
      "Type": "String",
      "Description": "The data namespace of the service. For more information, call DescribeMetricMetaList\nor see Preset metrics reference."
    },
    "GroupId": {
      "Type": "String",
      "Description": "The ID of application group."
    },
    "MetricName": {
      "Type": "String",
      "Description": "The name of the metric. For more information, call DescribeMetricMetaList or see Preset metrics reference."
    },
    "Escalations": {
      "Type": "Json"
    },
    "EmailSubject": {
      "Type": "String",
      "Description": "The subject of the alert notification email."
    },
    "Webhook": {
      "Type": "String",
      "Description": "The URL of the callback triggered when an alert occurs."
    },
    "RuleName": {
      "Type": "String",
      "Description": "The name of the alert rule."
    },
    "Interval": {
      "Type": "Number",
      "Description": "The detection period of alerts."
    }
  },
  "Resources": {
    "GroupMetricRule": {
      "Type": "ALIYUN::CMS::GroupMetricRule",
      "Properties": {
        "NoEffectiveInterval": {
          "Ref": "NoEffectiveInterval"
        },
        "SilenceTime": {
          "Ref": "SilenceTime"
        },
        "Category": {
          "Ref": "Category"
        },
        "RuleId": {
          "Ref": "RuleId"
        },
        "Dimensions": {
          "Ref": "Dimensions"
        },
        "Period": {
          "Ref": "Period"
        },
        "EffectiveInterval": {
          "Ref": "EffectiveInterval"
        },
        "Namespace": {
          "Ref": "Namespace"
        },
        "GroupId": {
          "Ref": "GroupId"
        },
        "MetricName": {
          "Ref": "MetricName"
        },
        "Escalations": {
          "Ref": "Escalations"
        },
        "EmailSubject": {
          "Ref": "EmailSubject"
        },
        "Webhook": {
          "Ref": "Webhook"
        },
        "RuleName": {
          "Ref": "RuleName"
        },
        "Interval": {
          "Ref": "Interval"
        }
      }
    }
  },
  "Outputs": {
    "RuleId": {
      "Description": "Rule ID.",
      "Value": {
        "Fn::GetAtt": [
          "GroupMetricRule",
          "RuleId"
        ]
      }
    }
  }
}

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  NoEffectiveInterval:
    Type: String
    Description: The period when the alert rule is ineffective.
  SilenceTime:
    Type: Number
    Description: >-
      The duration of the mute period during which new alerts are not sent even
      if the trigger
      conditions are met. Unit: second. Default value: 86400. Minimum value: 60.
    MinValue: 60
  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)
      DCDN (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)
  RuleId:
    Type: String
    Description: >-
      The ID of the alert rule. The IDs of alert rules are generated by callers
      to ensure

      uniqueness.
  Dimensions:
    Type: String
    Description: The expended resource dimensions.
  Period:
    Type: Number
    Description: 'The aggregation period. Unite: second.'
  EffectiveInterval:
    Type: String
    Description: The period when the alert rule is effective.
  Namespace:
    Type: String
    Description: >-
      The data namespace of the service. For more information, call
      DescribeMetricMetaList
      or see Preset metrics reference.
  GroupId:
    Type: String
    Description: The ID of application group.
  MetricName:
    Type: String
    Description: >-
      The name of the metric. For more information, call DescribeMetricMetaList
      or see Preset metrics reference.
  Escalations:
    Type: Json
  EmailSubject:
    Type: String
    Description: The subject of the alert notification email.
  Webhook:
    Type: String
    Description: The URL of the callback triggered when an alert occurs.
  RuleName:
    Type: String
    Description: The name of the alert rule.
  Interval:
    Type: Number
    Description: The detection period of alerts.
Resources:
  GroupMetricRule:
    Type: 'ALIYUN::CMS::GroupMetricRule'
    Properties:
      NoEffectiveInterval:
        Ref: NoEffectiveInterval
      SilenceTime:
        Ref: SilenceTime
      Category:
        Ref: Category
      RuleId:
        Ref: RuleId
      Dimensions:
        Ref: Dimensions
      Period:
        Ref: Period
      EffectiveInterval:
        Ref: EffectiveInterval
      Namespace:
        Ref: Namespace
      GroupId:
        Ref: GroupId
      MetricName:
        Ref: MetricName
      Escalations:
        Ref: Escalations
      EmailSubject:
        Ref: EmailSubject
      Webhook:
        Ref: Webhook
      RuleName:
        Ref: RuleName
      Interval:
        Ref: Interval
Outputs:
  RuleId:
    Description: Rule ID.
    Value:
      'Fn::GetAtt':
        - GroupMetricRule
        - RuleId