ALIYUN::CMS::MetricRuleTemplate类型用于创建报警模板。

语法

{
  "Type": "ALIYUN::CMS::MetricRuleTemplate",
  "Properties": {
    "AlertTemplates": List,
    "Description": String,
    "RestVersion": Integer,
    "TemplateId": Integer,
    "Name": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
AlertTemplates List 报警模板。 最多添加200个规则。

更多信息,请参见AlertTemplates属性

Description String 报警模板描述信息。
RestVersion Integer 报警模板版本。 默认值为0。
TemplateId Integer 克隆模板ID。
Name String 报警模板名称。

AlertTemplates语法

"AlertTemplates": [
  {
    "MetricName": String,
    "Category": String,
    "Escalations": Map,
    "Period": Integer,
    "Webhook": String,
    "Namespace": String,
    "RuleName": String,
    "Selector": String
  }
]

AlertTemplates属性

属性名称 类型 必须 允许更新 描述 约束
MetricName String 监控项名称。
Category String 产品名称或产品规格缩写。 取值:
  • ecs:云服务器。
  • rds:阿里云关系型数据库。
  • ads:云原生数据仓库AnalyticDB MySQL版。
  • slb:负载均衡。
  • vpc:专有网络。
  • apigateway:API网关。
  • cdn:内容分发网络。
  • cs:容器服务Kubernetes版。
  • dcdn:全站加速。
  • ddos:DDoS高防。
  • eip:弹性公网IP。
  • elasticsearch:阿里云Elasticsearch。
  • emr:阿里云E-MapReduce。
  • ess:弹性伸缩。
  • hbase:云数据库HBase版。
  • iot_edge:物联网边缘计算。
  • k8s_pod:k8s pod。
  • kvstore_sharding:Redis集群版。
  • kvstore_splitrw:Redis读写分离版。
  • kvstore_standard:Redis标准版。
  • memcache:云数据库Memcache版。
  • mns:消息服务。
  • mongodb:云数据库MongoDB版副本集实例。
  • mongodb_cluster:云数据库MongoDB版单节点实例。
  • mongodb_sharding:云数据库MongoDB版分片集群实例。
  • mq_topic:消息服务TOPIC。
  • ocs:云数据库Memcache版。
  • opensearch:开放搜索。
  • oss:对象存储服务。
  • polardb:云数据库PolarDB。
  • petadata:HybridDB for MySQL。
  • scdn:安全加速。
  • sharebandwidthpackages:共享带宽包。
  • sls:日志服务。
  • vpn:VPN网关。
Escalations Map 报警配置。 更多信息,请参见Escalations属性
Period Integer 监控数据的聚合周期。 默认为监控项对应的最小频率,通常不需要指定。

单位:秒。

Webhook String 报警发生时的回调URL地址。
Namespace String 产品的数据命名空间。 更多信息,请参见DescribeMetricMetaList监控项使用说明
RuleName String 报警规则的名称。
Selector String 扩展字段选项。

Escalations语法

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

Escalations属性

属性名称 类型 必须 允许更新 描述 约束
Critical Map Critical级别报警设置。 更多信息,请参见Critical属性
Info Map Info级别报警设置。 更多信息,请参见Info属性
Warn Map Warn级别报警设置。 更多信息,请参见Warn属性

Critical语法

"Critical": {
  "ComparisonOperator": String,
  "Times": Integer,
  "Statistics": String,
  "Threshold": String
}

Critical属性

属性名称 类型 必须 允许更新 描述 约束
ComparisonOperator String 阈值比较符。 取值:
  • GreaterThanOrEqualToThreshold:大于等于。
  • GreaterThanThreshold:大于。
  • LessThanOrEqualToThreshold:小于等于。
  • LessThanThreshold:小于。
  • NotEqualToThreshold:不等。
  • GreaterThanYesterday:同比昨天时间上涨。
  • LessThanYesterday:同比昨天时间下降。
  • GreaterThanLastWeek:同比上周同一时间上涨。
  • LessThanLastWeek:同比上周同一时间下降。
  • GreaterThanLastPeriod:环比上周期上涨。
  • LessThanLastPeriod:环比上周期下降。
Times Integer 报警重试次数。
Statistics String 报警统计方法。
Threshold String 报警阈值。

Info语法

"Info": {
  "ComparisonOperator": String,
  "Times": Integer,
  "Statistics": String,
  "Threshold": String
}

Info属性

属性名称 类型 必须 允许更新 描述 约束
ComparisonOperator String 阈值比较符。 取值:
  • GreaterThanOrEqualToThreshold:大于等于。
  • GreaterThanThreshold:大于。
  • LessThanOrEqualToThreshold:小于等于
  • LessThanThreshold:小于。
  • NotEqualToThreshold:不等。
  • GreaterThanYesterday:同比昨天时间上涨。
  • LessThanYesterday:同比昨天时间下降。
  • GreaterThanLastWeek:同比上周同一时间上涨。
  • LessThanLastWeek:同比上周同一时间下降。
  • GreaterThanLastPeriod:环比上周期上涨。
  • LessThanLastPeriod:环比上周期下降。
Times Integer 报警重试次数。
Statistics String 报警统计方法。
Threshold String 报警阈值。

Warn语法

"Warn": {
  "ComparisonOperator": String,
  "Times": Integer,
  "Statistics": String,
  "Threshold": String
}

Warn属性

属性名称 类型 必须 允许更新 描述 约束
ComparisonOperator String 阈值比较符。 取值:
  • GreaterThanOrEqualToThreshold:大于等于。
  • GreaterThanThreshold:大于。
  • LessThanOrEqualToThreshold:小于等于。
  • LessThanThreshold:小于。
  • NotEqualToThreshold:不等。
  • GreaterThanYesterday:同比昨天时间上涨。
  • LessThanYesterday:同比昨天时间下降。
  • GreaterThanLastWeek:同比上周同一时间上涨。
  • LessThanLastWeek:同比上周同一时间下降。
  • GreaterThanLastPeriod:环比上周期上涨。
  • LessThanLastPeriod:环比上周期下降。
Times Integer 报警重试次数。
Statistics String 报警统计方法。
Threshold String 报警阈值。

返回值

Fn::GetAtt

Id:报警模板ID。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "AlertTemplates": {
      "Type": "Json",
      "Description": "Valid values of N: 0 to 200.",
      "MinLength": 0,
      "MaxLength": 200
    },
    "Description": {
      "Type": "String",
      "Description": "The description of the alert template."
    },
    "RestVersion": {
      "Type": "Number",
      "Description": "The version of the alert template. Call DescribeMetricRuleTemplateList or DescribeMetricRuleTemplateAttribute\nto obtain information about the alert templates. The combination of version and ID\nuniquely identifies an alert template."
    },
    "TemplateId": {
      "Type": "Number",
      "Description": "The ID of the alert template."
    },
    "Name": {
      "Type": "String",
      "Description": "The name of the alert template."
    }
  },
  "Resources": {
    "MetricRuleTemplate": {
      "Type": "ALIYUN::CMS::MetricRuleTemplate",
      "Properties": {
        "AlertTemplates": {
          "Ref": "AlertTemplates"
        },
        "Description": {
          "Ref": "Description"
        },
        "RestVersion": {
          "Ref": "RestVersion"
        },
        "TemplateId": {
          "Ref": "TemplateId"
        },
        "Name": {
          "Ref": "Name"
        }
      }
    }
  },
  "Outputs": {
    "Id": {
      "Description": "Alarm template ID.",
      "Value": {
        "Fn::GetAtt": [
          "MetricRuleTemplate",
          "Id"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  AlertTemplates:
    Type: Json
    Description: 'Valid values of N: 0 to 200.'
    MinLength: 0
    MaxLength: 200
  Description:
    Type: String
    Description: The description of the alert template.
  RestVersion:
    Type: Number
    Description: >-
      The version of the alert template. Call DescribeMetricRuleTemplateList or
      DescribeMetricRuleTemplateAttribute

      to obtain information about the alert templates. The combination of
      version and ID

      uniquely identifies an alert template.
  TemplateId:
    Type: Number
    Description: The ID of the alert template.
  Name:
    Type: String
    Description: The name of the alert template.
Resources:
  MetricRuleTemplate:
    Type: 'ALIYUN::CMS::MetricRuleTemplate'
    Properties:
      AlertTemplates:
        Ref: AlertTemplates
      Description:
        Ref: Description
      RestVersion:
        Ref: RestVersion
      TemplateId:
        Ref: TemplateId
      Name:
        Ref: Name
Outputs:
  Id:
    Description: Alarm template ID.
    Value:
      'Fn::GetAtt':
        - MetricRuleTemplate
        - Id