Nama templat
ACS-ECS-AlarmWhenDiscountAndPriceExceedsThresholdInMultiZoneAndInstanceType: Mengirimkan pemberitahuan peringatan ketika diskon atau harga spot dari tipe instans ECS tertentu di beberapa zona melebihi ambang batas.
Deskripsi templat
Mengirimkan pemberitahuan peringatan ketika diskon atau harga spot dari tipe instans ECS tertentu di beberapa zona melebihi ambang batas.
Jenis templat
Automation
Pemilik
Alibaba Cloud
Parameter input
|
Parameter name |
Description |
Type |
Required |
Default value |
Constraints |
|
zoneId |
Zone ID |
List |
Yes |
||
|
instanceType |
Instance type |
List |
Yes |
||
|
threshold |
Ambang batas harga atau diskon. |
Number |
Yes |
||
|
webhook |
URL webhook DingTalk untuk menerima notifikasi. |
String |
Yes |
||
|
region |
Region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
taskType |
Jenis tugas pemantauan. |
String |
No |
Discount |
|
|
rateControl |
Laju konkurensi untuk eksekusi tugas. |
Json |
No |
{‘Mode’: ‘Concurrency’, ‘MaxErrors’: 100, ‘Concurrency’: 10} |
|
|
OOSAssumeRole |
Peran RAM yang diasumsikan oleh OOS. |
String |
No |
OOSServiceRole |
Parameter output
|
Parameter name |
Description |
Type |
|
allThresholdInfo |
Json |
Kebijakan akses yang diperlukan untuk eksekusi
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeAvailableResource",
"ecs:DescribeSpotPriceHistory"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Detail
ACS-ECS-AlarmWhenDiscountAndPriceExceedsThresholdInMultiZoneAndInstanceType
Isi templat
FormatVersion: OOS-2019-06-01
Description:
en: Sends an alert when the discount or spot price for multiple instance types in multiple zones exceeds a threshold.
zh-cn: Sends an alert when the discount or spot price for multiple instance types in multiple zones exceeds a threshold.
name-en: ACS-ECS-AlarmWhenDiscountAndPriceExceedsThresholdInMultiZoneAndInstanceType
name-zh-cn: Monitor and alert when discount and spot price for multiple instance types in multiple zones exceed a threshold.
categories:
- instance_manage
Parameters:
region:
Type: String
Label:
en: Region ID
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
zoneId:
Description:
en: The zone ID.
zh-cn: The zone ID.
Label:
en: Zone
zh-cn: Zone
Type: List
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
RegionId: region
AutoChangeType: false
instanceType:
Description:
en: The instance type.
zh-cn: The instance type.
Label:
en: Instance type
zh-cn: Instance type
Type: List
AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
AssociationPropertyMetadata:
Multiple: true
RegionId: region
ZoneIds: '${zoneId}'
taskType:
Description:
en: 'The type of monitoring job. Valid values: Discount (monitors the discount) or Price (monitors the price).'
zh-cn: 'The type of monitoring job. Valid values: Discount (monitors the discount) or Price (monitors the price).'
Label:
en: Monitoring job type
zh-cn: Monitoring job type
Type: String
Default: Discount
AllowedValues:
- Discount
- Price
threshold:
Description:
en: 'The price or discount threshold. For discounts, the value represents a percentage of the original price. For example, 10 means 10% of the original price (a 90% discount). For prices, enter the price threshold directly.'
zh-cn: 'The price or discount threshold. For discounts, the value represents a percentage of the original price. For example, 10 means 10% of the original price (a 90% discount). For prices, enter the price threshold directly.'
Label:
en: Price/discount threshold
zh-cn: Price/discount threshold
Type: Number
webhook:
Label:
en: DingTalk webhook URL
zh-cn: 'DingTalk webhook URL'
Description:
en: 'Example: https://oapi.dingtalk.com/robot/send?access_token=bac51db2e39418ec6c2dbb27fd111bc7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.'
zh-cn: 'Example: https://oapi.dingtalk.com/robot/send?access_token=bac51db2e39418ec6c2dbb27fd111bc7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.'
Type: String
rateControl:
Label:
en: Concurrency rate
zh-cn: Concurrency rate
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 100
Concurrency: 10
OOSAssumeRole:
Label:
en: RAM role for OOS
zh-cn: RAM role for OOS
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: alarmThresholdInfo
Action: 'ACS::ECS::AlarmSpotPriceByDiscountThresholdWithMultiTypes'
Description:
en: Sends an alert when the discount or spot price for multiple instance types in multiple zones exceeds a threshold.
zh-cn: Sends an alert when the discount or spot price for multiple instance types in multiple zones exceeds a threshold.
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: whetherToNotifyWebhook
Action: 'ACS::Choice'
Description:
en: Checks if an alert notification is required.
zh-cn: Checks if an alert notification is required.
Properties:
DefaultTask: alarmNotify
Choices:
- When:
'Fn::Equals':
- []
- 'Fn::MergeList': '{{ alarmThresholdInfo.allThresholdInfos }}'
NextTask: 'ACS::END'
- Name: alarmNotify
Action: 'ACS::Notify'
Description:
en: Sends an alert notification if the instance discount or spot price exceeds the threshold.
zh-cn: Sends an alert notification if the instance discount or spot price exceeds the threshold.
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ webhook }}'
Headers:
Content-Type: application/json
Content:
msgtype: markdown
markdown:
title: Monitoring Result
text:
'Fn::Join':
- ''
- 'Fn::ListJoin':
- |
##### Alarm threshold: {{ threshold }}
- |
| Instance type |  Zone|Current 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':
- |
##### Alarm threshold: {{ threshold }}
- |
| Instance type |  Zone|Current 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: Configure Parameters
en: Configure Parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced Options
en: Advanced Options