Nama Template
ACS-ECS-AlarmWhenDiscountAndPriceExceedsThresholdInMultiZoneAndInstanceType
Deskripsi Template
Memantau harga atau diskon dari tipe instans tertentu di zona yang ditentukan dan mengirimkan notifikasi peringatan jika harga atau diskon melebihi ambang batas tertentu.
Tipe Template
Otomatis
Pemilik
Alibaba Cloud
Parameter Input
Parameter | Deskripsi | Tipe | Diperlukan | Nilai Default | Batasan |
zoneId | ID zona. | Daftar | Ya | ||
instanceType | Tipe instans. | Daftar | Ya | ||
threshold | Ambang batas diskon atau harga spot. | Angka | Ya | ||
webhook | URL webhook chatbot DingTalk. | String | Ya | ||
region | ID wilayah. | String | Tidak | {{ ACS::RegionId }} | |
taskType | Tipe pekerjaan pemantauan. | String | Tidak | Discount | |
rateControl | Pengaturan kontrol laju. | Json | Tidak | {'Mode': 'Concurrency', 'MaxErrors': 100, 'Concurrency': 10} | |
OOSAssumeRole | Peran Resource Access Management (RAM) yang diasumsikan oleh CloudOps Orchestration Service (OOS). | String | Tidak | OOSServiceRole |
Parameter Output
Parameter | Deskripsi | Tipe |
allThresholdInfo | Json |
Kebijakan izin yang diperlukan untuk mengeksekusi template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeAvailableResource",
"ecs:DescribeSpotPriceHistory"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Referensi
Untuk informasi lebih lanjut, lihat ACS-ECS-AlarmWhenDiscountAndPriceExceedsThresholdInMultiZoneAndInstanceType.yml di GitHub.
Isi Template
FormatVersion: OOS-2019-06-01
Description:
en: Alarm when monitoring the discount and spot price of multi-instance types in multi-availability zone exceeding the threshold
zh-cn: deskripsi dalam bahasa Cina
name-en: ACS-ECS-AlarmWhenDiscountAndPriceExceedsThresholdInMultiZoneAndInstanceType
name-zh-cn: deskripsi dalam bahasa Cina
categories:
- instance_manage
Parameters:
region:
Type: String
Label:
en: RegionId
zh-cn: deskripsi dalam bahasa Cina
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
zoneId:
Description:
en: The zone id
zh-cn: deskripsi dalam bahasa Cina
Label:
en: ZoneId
zh-cn: deskripsi dalam bahasa Cina
Type: List
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
RegionId: region
AutoChangeType: false
instanceType:
Description:
en: The instance type
zh-cn: deskripsi dalam bahasa Cina
Label:
en: InstanceType
zh-cn: deskripsi dalam bahasa Cina
Type: List
AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
AssociationPropertyMetadata:
Multiple: true
RegionId: region
ZoneIds: '${zoneId}'
taskType:
Description:
en: The monitoring threshold task type (Discount: Monitor discount, Price: monitor price)
zh-cn: deskripsi dalam bahasa Cina
Label:
en: TaskType
zh-cn: deskripsi dalam bahasa Cina
Type: String
Default: Discount
AllowedValues:
- Discount
- Price
threshold:
Description:
en: 'The discount/price threshold(example:10 is 1% off,50 is 50% off,Or directly enter the price threshold).'
zh-cn: deskripsi dalam bahasa Cina
Label:
en: Threshold
zh-cn: deskripsi dalam bahasa Cina
Type: Number
webhook:
Label:
en: Webhook
zh-cn: deskripsi dalam bahasa Cina
Description:
en: '(example:https://oapi.dingtalk.com/robot/send?access_token=bac51db2e39418ec6c2dbb27fd111bc7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).'
zh-cn: deskripsi dalam bahasa Cina '
Type: String
rateControl:
Label:
en: RateControl
zh-cn: deskripsi dalam bahasa Cina
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 100
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: deskripsi dalam bahasa Cina
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: alarmThresholdInfo
Action: 'ACS::ECS::AlarmSpotPriceByDiscountThresholdWithMultiTypes'
Description:
en: Alarm when monitoring the discount and spot price of multi-instance types under multi-availability zone exceeding the threshold
zh-cn: deskripsi dalam bahasa Cina
Properties:
regionId: '{{ region }}'
zoneId: '{{ ACS::TaskLoopItem }}'
instanceTypes: '{{ instanceType }}'
threshold: '{{ threshold }}'
taskType: '{{ taskType }}'
Outputs:
zoneInstanceTypeThresholdInfo:
Type: Json
ValueSelector: instanceTypeThresholdInfo
Loop:
Items: '{{ zoneId }}'
RateControl: '{{ rateControl }}'
Outputs:
allThresholdInfos:
AggregateField: zoneInstanceTypeThresholdInfo
AggregateType: 'Fn::ListJoin'
- Name: wetherNodifyWebhook
Action: 'ACS::Choice'
Description:
en: Detect if an alarm notification is required
zh-cn: deskripsi dalam bahasa Cina
Properties:
DefaultTask: alarmNotify
Choices:
- When:
'Fn::Equals':
- []
- 'Fn::MergeList': '{{ alarmThresholdInfo.allThresholdInfos }}'
NextTask: 'ACS::END'
- Name: alarmNotify
Action: 'ACS::Notify'
Description:
en: Instance discount / spot price exceeds threshold alarm notification
zh-cn: deskripsi dalam bahasa Cina
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ webhook }}'
Headers:
Content-Type: application/json
Content:
msgtype: markdown
markdown:
title: Monitoring results
text:
'Fn::Join':
- ''
- 'Fn::ListJoin':
- |
##### The alert threshold (alarm threshold):{{ threshold }}
- |
| Instance type |  Zone|Ccurrent price|Discount|
- |
|:----|----:|:----:|:----|
- 'Fn::Jq':
- First
- '.[]|split(", ") | join("") |split("\n,")| join("")| split("\n,|")|join("") |split("||")|join("|")'
- 'Fn::Jq':
- All
- '.[1]=""|join("|")'
- 'Fn::Jq':
- All
- '.[1]=""| .[1]=.[0] | .[0]="" | join("|")'
- 'Fn::Jq':
- All
- map(.) | join("\n|")
- 'Fn::Jq':
- All
- '.[] | map(.[] | tostring)| join(" |")'
- 'Fn::Jq':
- All
- 'map(.| .threshold=.threshold+" |\n," )'
- 'Fn::MergeList': '{{ alarmThresholdInfo.allThresholdInfos }}'
Outputs:
allThresholdInfo:
Type: Json
Value:
'Fn::Join':
- ''
- 'Fn::ListJoin':
- |
##### The alert threshold (alarm threshold):{{ threshold }}
- |
| Instance type |  Zone|Ccurrent price|Discount|
- |
|:----|----:|:----:|:----|
- 'Fn::Jq':
- First
- '.[]|split(", ") | join("") |split("\n,")| join("")| split("\n,|")|join("") |split("||")|join("|")'
- 'Fn::Jq':
- All
- '.[1]=""|join("|")'
- 'Fn::Jq':
- All
- '.[1]=""| .[1]=.[0] | .[0]="" | join("|")'
- 'Fn::Jq':
- All
- map(.) | join("\n|")
- 'Fn::Jq':
- All
- '.[] | map(.[] | tostring)| join(" |")'
- 'Fn::Jq':
- All
- 'map(.| .threshold=.threshold+" |\n," )'
- 'Fn::MergeList': '{{ alarmThresholdInfo.allThresholdInfos }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- region
- zoneId
- instanceType
- taskType
- threshold
- webhook
Label:
default:
zh-cn: deskripsi dalam bahasa Cina
en: Configure Parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: deskripsi dalam bahasa Cina
en: Control Options