ALIYUN::CMS::MetricRuleTemplate は、アラートテンプレートを作成するために使用されます。
構文
{
"Type": "ALIYUN::CMS::MetricRuleTemplate",
"Properties": {
"AlertTemplates": List,
"Description": String,
"RestVersion": Integer,
"TemplateId": Integer,
"Name": String
}
}プロパティ
プロパティ | タイプ | 必須 | 編集可能 | 説明 | 制約 |
Name | String | はい | いいえ | アラートテンプレートの名前。 | なし。 |
AlertTemplates | List | いいえ | はい | アラートテンプレート内のルール。 | アラートテンプレートには最大 200 個のアラートルールを追加できます。 詳細については、「AlertTemplates プロパティ」をご参照ください。 |
Description | String | いいえ | はい | アラートテンプレートの説明。 | なし。 |
RestVersion | Integer | いいえ | いいえ | アラートテンプレートのバージョン。 | デフォルト値:0。 |
TemplateId | Integer | いいえ | いいえ | クローンを作成するテンプレートの ID。 | なし。 |
AlertTemplates 構文
"AlertTemplates": [
{
"MetricName": String,
"Category": String,
"Escalations": Map,
"Period": Integer,
"Webhook": String,
"Namespace": String,
"RuleName": String,
"Selector": String
}
]AlertTemplates プロパティ
プロパティ | タイプ | 必須 | 編集可能 | 説明 | 制約 |
Category | String | はい | はい | サービス名の省略形。 | 有効な値:
|
MetricName | String | はい | はい | メトリックの名前。 | なし。 |
Namespace | String | はい | はい | サービスの名前空間。 | 詳細については、「DescribeMetricMetaList」または「付録 1:メトリック」トピックの「使用方法」セクションをご参照ください。 |
RuleName | String | はい | はい | アラートルール名。 | なし。 |
Escalations | Map | いいえ | いいえ | アラート設定。 | 詳細については、「Escalations プロパティ」をご参照ください。 |
Period | Integer | いいえ | はい | メトリックデータの集計期間。 | デフォルト値は、メトリックがポーリングされる最低頻度です。ほとんどの場合、集計期間を指定する必要はありません。 単位:秒。 |
Selector | String | いいえ | はい | 拡張フィールドセレクター。 | なし。 |
Webhook | String | いいえ | いいえ | アラートが発生したときにリクエストが送信されるコールバック URL。 | なし。 |
Escalations 構文
"Escalations": {
"Critical": Map,
"Info": Map,
"Warn": Map
}Escalations プロパティ
プロパティ | タイプ | 必須 | 編集可能 | 説明 | 制約 |
Critical | Map | はい | はい | 緊急レベルのアラートの設定。 | 詳細については、「Critical プロパティ」をご参照ください。 |
Info | Map | いいえ | はい | 情報レベルのアラートの設定。 | 詳細については、「Info プロパティ」をご参照ください。 |
Warn | Map | いいえ | はい | 警告レベルのアラートの設定。 | 詳細については、「Warn プロパティ」をご参照ください。 |
Critical 構文
"Critical": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}Critical プロパティ
プロパティ | タイプ | 必須 | 編集可能 | 説明 | 制約 |
ComparisonOperator | String | はい | はい | メトリック値をしきい値と比較するために使用される演算子。 | 有効な値:
|
Statistics | String | はい | はい | アラートをトリガーする基準となるメトリック値を計算するために使用されるメソッド。 | なし。 |
Threshold | String | はい | はい | アラートのしきい値。 | なし。 |
Times | Integer | はい | はい | アラートがトリガーされる前に、メトリック値がアラート条件を満たす連続回数。 | なし。 |
Info 構文
"Info": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}Info プロパティ
プロパティ | タイプ | 必須 | 編集可能 | 説明 | 制約 |
ComparisonOperator | String | はい | はい | メトリック値をしきい値と比較するために使用される演算子。 | 有効な値:
|
Statistics | String | はい | はい | アラートをトリガーする基準となるメトリック値を計算するために使用されるメソッド。 | なし。 |
Threshold | String | はい | はい | アラートのしきい値。 | なし。 |
Times | Integer | はい | はい | アラートがトリガーされる前に、メトリック値がアラート条件を満たす連続回数。 | なし。 |
Warn 構文
"Warn": {
"ComparisonOperator": String,
"Times": Integer,
"Statistics": String,
"Threshold": String
}Warn プロパティ
プロパティ | タイプ | 必須 | 編集可能 | 説明 | 制約 |
ComparisonOperator | String | はい | はい | メトリック値をしきい値と比較するために使用される演算子。 | 有効な値:
|
Statistics | String | はい | はい | アラートをトリガーする基準となるメトリック値を計算するために使用されるメソッド。 | なし。 |
Threshold | String | はい | はい | アラートのしきい値。 | なし。 |
Times | Integer | はい | はい | アラートがトリガーされる前に、メトリック値がアラート条件を満たす連続回数。 | なし。 |
戻り値
Fn::GetAtt
Id: アラートテンプレートの ID。
例
YAML
ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
MetricRuleTemplate:
Type: ALIYUN::CMS::MetricRuleTemplate
Properties:
AlertTemplates:
- Category: ecs
Namespace: acs_ecs_dashboard
Period: 60
Webhook: http://ww.aliyun.com
RuleName: CPU monitoring
Selector: ''
MetricName: cpu_total
Escalations:
Critical:
Statistics: Average
Threshold: '90'
ComparisonOperator: GreaterThanOrEqualToThreshold
Times: 3
Warn:
Statistics: Average
Threshold: '80'
ComparisonOperator: GreaterThanOrEqualToThreshold
Times: 3
Info:
Statistics: Average
Threshold: '70'
ComparisonOperator: GreaterThanOrEqualToThreshold
Times: 3
- Category: ecs
Namespace: acs_ecs_dashboard
Period: 60
RuleName: Disk monitoring
Selector: '{"disk":"/"}'
MetricName: diskusage_total
Escalations:
Critical:
Statistics: Average
Threshold: '500'
ComparisonOperator: GreaterThanOrEqualToThreshold
Times: 5
Name: TestMetricRuleTemplate
Outputs:
Id:
Description: アラームテンプレート ID。
Value:
Fn::GetAtt:
- MetricRuleTemplate
- IdJSON
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
},
"Resources": {
"MetricRuleTemplate": {
"Type": "ALIYUN::CMS::MetricRuleTemplate",
"Properties": {
"AlertTemplates": [
{
"Category": "ecs",
"Namespace": "acs_ecs_dashboard",
"Period": 60,
"Webhook": "http://ww.aliyun.com",
"RuleName": "CPU monitoring",
"Selector": "",
"MetricName": "cpu_total",
"Escalations": {
"Critical": {
"Statistics": "Average",
"Threshold": "90",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Times": 3
},
"Warn": {
"Statistics": "Average",
"Threshold": "80",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Times": 3
},
"Info": {
"Statistics": "Average",
"Threshold": "70",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Times": 3
}
}
},
{
"Category": "ecs",
"Namespace": "acs_ecs_dashboard",
"Period": 60,
"RuleName": "Disk monitoring",
"Selector": "{\"disk\":\"/\"}",
"MetricName": "diskusage_total",
"Escalations": {
"Critical": {
"Statistics": "Average",
"Threshold": "500",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Times": 5
}
}
}
],
"Name": "TestMetricRuleTemplate"
}
}
},
"Outputs": {
"Id": {
"Description": "アラームテンプレート ID。",
"Value": {
"Fn::GetAtt": [
"MetricRuleTemplate",
"Id"
]
}
}
}
}