テンプレート名
ACS-ECS-AlarmAccountResourceUsage:アカウントのリソース使用量が指定のしきい値を超えた場合にアラートを送信します。
テンプレートの説明
アカウントのリソース使用量が指定のしきい値を超えた場合にアラートを送信します。
テンプレートタイプ
オートメーション
所有者
Alibaba Cloud
入力パラメーター
|
パラメーター名 |
説明 |
タイプ |
必須 |
デフォルト値 |
制約 |
|
webHookUrl |
例:https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414。 DingTalk Webhook の取得方法については、 https://www.alibabacloud.com/help/document_detail/144679.html をご参照ください。 |
String |
はい |
||
|
regionId |
リージョン ID |
String |
いいえ |
{{ ACS::RegionId }} |
|
|
threshold |
アラートをトリガーするリソース使用量のしきい値。 |
Number |
いいえ |
80 |
MinValue: 20, MaxValue: 99 |
|
OOSAssumeRole |
OOS が引き受ける RAM ロール。 |
String |
いいえ |
OOSServiceRole |
出力パラメーター
なし
このテンプレートの実行に必要なアクセスポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeAccountAttributes"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
「ACS-ECS-AlarmAccountResourceUsage」の詳細
テンプレートの内容
FormatVersion: OOS-2019-06-01
Description:
ja: リソース使用量がしきい値を超えた場合にアラートを送信します。
en: Sends an alert notification when resource usage exceeds the threshold.
name-ja: ACS-ECS-AlarmAccountResourceUsage
name-en: ACS-ECS-AlarmAccountResourceUsage
Parameters:
regionId:
Type: String
Label:
ja: リージョン ID
en: RegionId
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
threshold:
Label:
ja: しきい値
en: Threshold
Description:
ja: '例:10 は 10%、50 は 50% を表します。'
en: 'For example, 10 means 10% and 50 means 50%.'
Type: Number
Default: 80
MinValue: 20
MaxValue: 99
webHookUrl:
Description:
ja: '例:https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414。 DingTalk Webhook の取得方法については、 https://www.alibabacloud.com/help/document_detail/144679.html をご参照ください。'
en: 'For example: https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414. For more information about how to obtain a DingTalk webhook, see https://www.alibabacloud.com/help/document_detail/144679.html.'
Label:
ja: WebHookUrl
en: WebHookUrl
Type: String
OOSAssumeRole:
Label:
ja: OOSAssumeRole
en: OOSAssumeRole
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: 'ACS::TimerTrigger'
Description:
ja: cron 式で指定したスケジュールでタスクをトリガーします。
en: Triggers a task on a schedule that is specified by a cron expression.
Properties:
Type: rate
Expression: 30 minutes
EndDate: '2099-12-01T00:00:00Z'
- Name: getAccountAttributes
Action: 'ACS::ExecuteApi'
Description:
ja: リージョンで作成できる ECS リソースのクォータを照会します。
en: Queries the quotas for ECS resources that you can create in a region.
Properties:
Service: ECS
API: DescribeAccountAttributes
Parameters:
RegionId: '{{ regionId }}'
Outputs:
usedPostpaidInstanceVcpuCount:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[13].AttributeValues.ValueItem[].Value | tonumber'
Type: Number
usedSpotInstanceVcpuCount:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[14].AttributeValues.ValueItem[].Value | tonumber'
Type: Number
usedPostpaidYundiskCapacityCloudEfficiency:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[16].AttributeValues.ValueItem[0].Value | tonumber'
Type: Number
usedPostpaidYundiskCapacityCloudSsd:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[16].AttributeValues.ValueItem[1].Value | tonumber'
Type: Number
usedPostpaidYundiskCapacityCloudEssd:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[16].AttributeValues.ValueItem[2].Value | tonumber'
Type: Number
maxPostpaidInstanceVcpuCount:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[6].AttributeValues.ValueItem[].Value | tonumber'
Type: Number
maxSpotInstanceVcpuCount:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[7].AttributeValues.ValueItem[].Value | tonumber'
Type: Number
maxPostpaidYundiskCapacityCloudEfficiency:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[15].AttributeValues.ValueItem[0].Value | tonumber'
Type: Number
maxPostpaidYundiskCapacityCloudSsd:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[15].AttributeValues.ValueItem[1].Value | tonumber'
Type: Number
maxPostpaidYundiskCapacityCloudEssd:
ValueSelector: '.AccountAttributeItems.AccountAttributeItem[15].AttributeValues.ValueItem[2].Value | tonumber'
Type: Number
- Name: checkResourceUsage
Action: 'ACS::Choice'
Description:
ja: リソース使用量に基づいて通知タスクを選択します。
en: Selects the notification task based on resource usage.
Properties:
DefaultTask: 'ACS::END'
Choices:
- When:
'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidInstanceVcpuCount}} / {{getAccountAttributes.maxPostpaidInstanceVcpuCount}}) >= {{ threshold }}/100'
- '{"": ""}'
NextTask: alarmNotify
- When:
'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedSpotInstanceVcpuCount}} / {{getAccountAttributes.maxSpotInstanceVcpuCount}}) >= {{ threshold }}/100'
- '{"": ""}'
NextTask: alarmNotify
- When:
'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidYundiskCapacityCloudEfficiency}} / {{getAccountAttributes.maxPostpaidYundiskCapacityCloudEfficiency}}) >= {{ threshold }}/100'
- '{"": ""}'
NextTask: alarmNotify
- When:
'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidYundiskCapacityCloudSsd}} / {{getAccountAttributes.maxPostpaidYundiskCapacityCloudSsd}}) >= {{ threshold }}/100'
- '{"": ""}'
NextTask: alarmNotify
- When:
'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidYundiskCapacityCloudEssd}} / {{getAccountAttributes.maxPostpaidYundiskCapacityCloudEssd}}) >= {{ threshold }}/100'
- '{"": ""}'
NextTask: alarmNotify
- Name: alarmNotify
Action: 'ACS::Notify'
OnSuccess: 'ACS::END'
Description:
ja: リソース使用量がしきい値を超えた場合にアラートを送信します。
en: Sends an alert notification if resource usage exceeds the threshold.
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ webHookUrl }}'
Headers:
Content-Type: application/json
Content:
msgtype: text
text:
content:
'Fn::Join':
- '|-|-|'
- - 'Fn::If':
- 'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidInstanceVcpuCount}} / {{getAccountAttributes.maxPostpaidInstanceVcpuCount}}) >= {{ threshold }}/100'
- '{"": ""}'
- 'アカウントの従量課金インスタンスの vCPU 使用率が {{ threshold }}% を超えました。'
- ''
- 'Fn::If':
- 'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedSpotInstanceVcpuCount}} / {{getAccountAttributes.maxSpotInstanceVcpuCount}}) >= {{ threshold }}/100'
- '{"": ""}'
- 'アカウントのスポットインスタンスの vCPU 使用率が {{ threshold }}% を超えました。'
- ''
- 'Fn::If':
- 'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidYundiskCapacityCloudEfficiency}} / {{getAccountAttributes.maxPostpaidYundiskCapacityCloudEfficiency}}) >= {{ threshold }}/100'
- '{"": ""}'
- 'アカウントのデータディスク (従量課金 Ultra ディスク) の容量使用率が {{ threshold }}% を超えました。'
- ''
- 'Fn::If':
- 'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidYundiskCapacityCloudSsd}} / {{getAccountAttributes.maxPostpaidYundiskCapacityCloudSsd}}) >= {{ threshold }}/100'
- '{"": ""}'
- 'アカウントのデータディスク (従量課金 標準 SSD) の容量使用率が {{ threshold }}% を超えました。'
- ''
- 'Fn::If':
- 'Fn::Equals':
- true
- 'Fn::Jq':
- First
- '({{getAccountAttributes.usedPostpaidYundiskCapacityCloudEssd}} / {{getAccountAttributes.maxPostpaidYundiskCapacityCloudEssd}}) >= {{ threshold }}/100'
- '{"": ""}'
- 'アカウントのデータディスク (従量課金 ESSD) の容量使用率が {{ threshold }}% を超えました。'
- ''
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- threshold
- webHookUrl
Label:
default:
ja: パラメーターの設定
en: Configure Parameters
- Parameters:
- OOSAssumeRole
Label:
default:
ja: 詳細オプション
en: Advanced Options