文档

ALIYUN::CMS::GroupMetricRule

更新时间:

ALIYUN::CMS::GroupMetricRule类型用于创建应用分组报警规则。

语法

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

属性

属性名称

类型

必须

允许更新

描述

约束

NoEffectiveInterval

String

报警规则非生效时间范围。

SilenceTime

Integer

一直处于报警状态的通知沉默周期。

单位:秒。

最小值:3600秒(1小时)。

默认值:86,400秒(1天)。

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网关。

说明

云监控接入的产品会不断增加,包括但不仅限于上述产品

RuleId

String

报警规则ID。

由调用者统一生成以保证其唯一性。

Dimensions

String

扩展资源维度。

设置到组的报警规则会将组的实例资源全部关联到该报规则里。此参数设置除了实例外还可以设置更深一级的资源,例如想为应用分组下所有实例的根分区的磁盘使用率,此时可以设置为[ {"dskName":"/"} ]

Period

Integer

监控数据的聚合周期。

取值:60或60的整数倍。

单位:秒。

默认值:300秒。

说明

根据设置的报警统计方法,设置成300秒即表示将原始上报的5分钟监控数据平均值为1个点(假设原始上报监控数据为1分钟)作为是否报警的参考。

EffectiveInterval

String

报警规则的生效时间范围。

Namespace

String

产品的数据命名空间。更多信息,请参见DescribeMetricMetaList云服务主要监控项

GroupId

String

应用分组的ID。

MetricName

String

监控项名称。更多信息,请参见DescribeMetricMetaList云服务主要监控项

Escalations

Map

报警配置。

更多信息,请参见Escalations属性

EmailSubject

String

报警邮件主题。

Webhook

String

出现报警时触发的回调地址。

RuleName

String

报警规则名称。

Interval

Integer

报警规则的探测周期,即报警系统多长时间检查一次是否要触发报警规则,默认为监控项的最小频率。

单位:秒。

建议将报警的探测周期和上报数据周期保持一致,报警规则的探测周期小于上报周期会导致数据不足而不能触发报警。

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

Critical属性

属性名称

类型

必须

允许更新

描述

约束

ComparisonOperator

String

阈值比较符。

取值:

  • GreaterThanOrEqualToThreshold:大于等于。

  • GreaterThanThreshold:大于。

  • LessThanOrEqualToThreshold:小于等于。

  • LessThanThreshold:小于。

  • NotEqualToThreshold:不等。

  • GreaterThanYesterday:同比昨天时间上涨。

  • LessThanYesterday:同比昨天时间下降。

  • GreaterThanLastWeek:同比上周同一时间上涨。

  • LessThanLastWeek:同比上周同一时间下降。

  • GreaterThanLastPeriod:环比上周期上涨。

  • LessThanLastPeriod:环比上周期下降。

Times

Integer

报警重试次数。

Statistics

String

报警统计方法。

级别统计方法的取值,请参见DescribeSystemEventMetaList

Threshold

Integer

报警阈值。

Info语法

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

Info属性

属性名称

类型

必须

允许更新

描述

约束

ComparisonOperator

String

阈值比较符。

取值:

  • GreaterThanOrEqualToThreshold:大于等于。

  • GreaterThanThreshold:大于。

  • LessThanOrEqualToThreshold:小于等于

  • LessThanThreshold:小于。

  • NotEqualToThreshold:不等。

  • GreaterThanYesterday:同比昨天时间上涨。

  • LessThanYesterday:同比昨天时间下降。

  • GreaterThanLastWeek:同比上周同一时间上涨。

  • LessThanLastWeek:同比上周同一时间下降。

  • GreaterThanLastPeriod:环比上周期上涨。

  • LessThanLastPeriod:环比上周期下降。

Times

Integer

报警重试次数。

Statistics

String

报警统计方法。

级别统计方法的取值,请参见DescribeSystemEventMetaList

Threshold

Integer

报警阈值。

Warn语法

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

Warn属性

属性名称

类型

必须

允许更新

描述

约束

ComparisonOperator

String

阈值比较符。

取值:

  • GreaterThanOrEqualToThreshold:大于等于。

  • GreaterThanThreshold:大于。

  • LessThanOrEqualToThreshold:小于等于。

  • LessThanThreshold:小于。

  • NotEqualToThreshold:不等。

  • GreaterThanYesterday:同比昨天时间上涨。

  • LessThanYesterday:同比昨天时间下降。

  • GreaterThanLastWeek:同比上周同一时间上涨。

  • LessThanLastWeek:同比上周同一时间下降。

  • GreaterThanLastPeriod:环比上周期上涨。

  • LessThanLastPeriod:环比上周期下降。

Times

Integer

报警重试次数。

Statistics

String

报警统计方法。

级别统计方法的取值,请参见DescribeSystemEventMetaList

Threshold

Integer

报警阈值。

返回值

Fn::GetAtt

RuleId:报警规则ID。

示例

YAML格式

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格式

{
  "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"
        ]
      }
    }
  }
}
  • 本页导读 (1)
文档反馈