ALIYUN::ESS::AlarmTask

更新时间:
复制 MD 格式

Creates a metric-based alarm task for an Auto Scaling group.

Syntax

{
  "Type": "ALIYUN::ESS::AlarmTask",
  "Properties": {
    "Statistics": String,
    "Name": String,
    "EvaluationCount": Integer,
    "Period": Integer,
    "MetricType": String,
    "ComparisonOperator": String,
    "Dimensions": List,
    "ScalingGroupId": String,
    "AlarmAction": List,
    "Threshold": Number,
    "MetricName": String,
    "GroupId": Integer,
    "Description": String
  }
}

Properties

Property name Type Required Updatable Description Constraints
Statistics String No No The statistical method. Must match the defined metric. For example, Average. Valid values: Average, Minimum, and Maximum.
Name String No Yes The name of the alarm rule. None
EvaluationCount Integer No No Consecutive threshold breaches required to trigger an alarm. Default: 3. Minimum: 1.
Period Integer No No Query interval in seconds. Must match the defined metric. Default: 300. Valid values: 60, 120, 300, and 900.
MetricType String No No Standard. Valid values: system and custom.
ComparisonOperator String No No The comparison operator. Valid values: <=, <, >, and >=.
Dimensions List No No A list of instances for the alarm rule. One or more.
ScalingGroupId String Yes No The ID of the scaling group. None
AlarmAction List Yes Yes A list of alarm actions. 1 to 5 items.
Threshold Number Yes No The alarm threshold. Numeric values only. None
MetricName String Yes No The metric name. Each product defines its own valid metrics. None
GroupId Integer No No The group ID. None
Description String No Yes The description. None

Dimensions syntax

"Dimensions": [
  {
    "DimensionKey": String,
    "DimensionValue": String 
  }
]

Dimensions properties

Property name Type Required Updatable Description Constraints
DimensionValue String Yes No The value of the dimension that is associated with the metric. None
DimensionKey String Yes No The key of the dimension that is associated with the metric. None

Return value

Fn::GetAtt

AlarmTaskId: The ID of the alarm task.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      AutoScalingGroupId:
        Type: String
        AssociationProperty: ALIYUN::ESS::AutoScalingGroup::AutoScalingGroupId
      AlarmAction:
        Type: CommaDelimitedList
        Description: Alarm Actions
        MinLength: 1
        MaxLength: 5
    Resources:
      AlarmTask:
        Type: ALIYUN::ESS::AlarmTask
        Properties:
          ScalingGroupId:
            Ref: AutoScalingGroupId
          AlarmAction:
            - ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****
          Threshold: 1
          MetricName: TestMetric
          MetricType: custom
          Statistics: Average
    Outputs:
      AlarmTaskId:
        Description: The alarm task ID
        Value:
          Fn::GetAtt:
            - AlarmTask
            - AlarmTaskId
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "AutoScalingGroupId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ESS::AutoScalingGroup::AutoScalingGroupId"
        },
        "AlarmAction": {
          "Type": "CommaDelimitedList",
          "Description": "Alarm Actions",
          "MinLength": 1,
          "MaxLength": 5
        }
      },
      "Resources": {
        "AlarmTask": {
          "Type": "ALIYUN::ESS::AlarmTask",
          "Properties": {
            "ScalingGroupId": {
              "Ref": "AutoScalingGroupId"
            },
            "AlarmAction": [
              "ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****"
            ],
            "Threshold": 1,
            "MetricName": "TestMetric",
            "MetricType": "custom",
            "Statistics": "Average"
          }
        }
      },
      "Outputs": {
        "AlarmTaskId": {
          "Description": "The alarm task ID",
          "Value": {
            "Fn::GetAtt": [
              "AlarmTask",
              "AlarmTaskId"
            ]
          }
        }
      }
    }