ALIYUN::CMS::MetricRuleTemplateDeployment类型用于应用报警模板至应用分组。
语法
{
  "Type": "ALIYUN::CMS::MetricRuleTemplateDeployment",
  "Properties": {
    "GroupId": Integer,
    "TemplateIds": List,
    "AppendMode": String,
    "ApplyMode": String,
    "EnableEndTime": Integer,
    "EnableStartTime": Integer,
    "NotifyLevel": Integer,
    "SilenceTime": Integer,
    "Webhook": String
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| GroupId | Integer | 是 | 否 | 应用分组 ID。 | 关于如何获取应用分组 ID,请参见 DescribeMonitorGroups - 查询应用分组列表。 | 
| TemplateIds | List | 是 | 否 | 报警模板 ID。 | 关于如何获取报警模板 ID,请参见 DescribeMetricRuleTemplateList - 查询报警模板列表。 | 
| AppendMode | String | 否 | 否 | 模板应用策略。 | 取值: 
 | 
| ApplyMode | String | 否 | 否 | 模板应用方式。 | 取值: 
 | 
| EnableEndTime | Integer | 否 | 否 | 报警生效的结束时间。 | 取值范围:00~23,表示 00:59 到 23:59。 | 
| EnableStartTime | Integer | 否 | 否 | 报警生效的开始时间。 | 取值范围:00~23,表示 00:00 到 23:00。 | 
| NotifyLevel | Integer | 否 | 否 | 报警通知方式。 | 取值: 
 | 
| SilenceTime | Integer | 否 | 否 | 通道沉默周期。 | 单位:秒。默认值:86400。 说明  当监控数据持续超过报警规则阈值时,每个沉默周期内只发送一次报警通知。 | 
| Webhook | String | 否 | 否 | 报警发生时会回调指定的 URL 地址并发送 POST 请求。 | 无 | 
返回值
Fn::GetAtt
- RuleIds:报警规则 ID列表。 
- GroupId:应用分组 ID。 
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  TemplateIds:
    AssociationPropertyMetadata:
      Parameter:
        Type: String
        Required: false
        MinLength: 1
    AssociationProperty: List[Parameter]
    Type: Json
    Description:
      en: |-
        The ID list of the Alarm Template to be applied.
        For how to get the alarm template ID, see DescribeMetricRuleTemplateList.
    Required: true
    MinLength: 1
  GroupId:
    Type: Number
    Description:
      en: |-
        Apply group ID.
        For how to get the application group ID, see DescribeMonitorGroups.
    Required: true
    MaxValue: 9007199254740991
Resources:
  MetricRuleTemplateDeployment:
    Type: ALIYUN::CMS::MetricRuleTemplateDeployment
    Properties:
      TemplateIds:
        Ref: TemplateIds
      GroupId:
        Ref: GroupId
Outputs:
  RuleIds:
    Description: The IDs of rhe generated rules.
    Value:
      Fn::GetAtt:
        - MetricRuleTemplateDeployment
        - RuleIds
  GroupId:
    Description: The ID of the group that applied the template to.
    Value:
      Fn::GetAtt:
        - MetricRuleTemplateDeployment
        - GroupId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "TemplateIds": {
      "AssociationPropertyMetadata": {
        "Parameter": {
          "Type": "String",
          "Required": false,
          "MinLength": 1
        }
      },
      "AssociationProperty": "List[Parameter]",
      "Type": "Json",
      "Description": {
        "en": "The ID list of the Alarm Template to be applied.\nFor how to get the alarm template ID, see DescribeMetricRuleTemplateList."
      },
      "Required": true,
      "MinLength": 1
    },
    "GroupId": {
      "Type": "Number",
      "Description": {
        "en": "Apply group ID.\nFor how to get the application group ID, see DescribeMonitorGroups."
      },
      "Required": true,
      "MaxValue": 9007199254740991
    }
  },
  "Resources": {
    "MetricRuleTemplateDeployment": {
      "Type": "ALIYUN::CMS::MetricRuleTemplateDeployment",
      "Properties": {
        "TemplateIds": {
          "Ref": "TemplateIds"
        },
        "GroupId": {
          "Ref": "GroupId"
        }
      }
    }
  },
  "Outputs": {
    "RuleIds": {
      "Description": "The IDs of rhe generated rules.",
      "Value": {
        "Fn::GetAtt": [
          "MetricRuleTemplateDeployment",
          "RuleIds"
        ]
      }
    },
    "GroupId": {
      "Description": "The ID of the group that applied the template to.",
      "Value": {
        "Fn::GetAtt": [
          "MetricRuleTemplateDeployment",
          "GroupId"
        ]
      }
    }
  }
}