Nama templat
ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes – Mengirimkan notifikasi peringatan ketika harga atau diskon tipe instans yang ada dalam grup penskalaan melebihi ambang batas.
Deskripsi templat
Memantau diskon dan harga spot instans yang ada dalam grup penskalaan serta mengirimkan peringatan jika harga atau diskon melebihi ambang batas yang ditentukan.
Jenis templat
Automation
Pemilik
Alibaba Cloud
Parameter input
|
Nama parameter |
Deskripsi |
Tipe |
Wajib |
Nilai default |
Batasan |
|
scalingGroupId |
ID grup penskalaan. |
List |
Yes |
||
|
threshold |
Ambang batas harga atau diskon. |
Number |
Yes |
||
|
webhook |
URL webhook chatbot DingTalk yang menerima pesan. |
String |
Yes |
||
|
region |
ID wilayah. |
String |
No |
{{ ACS::RegionId }} |
|
|
taskType |
Jenis tugas pemantauan. |
String |
No |
Discount |
|
|
rateControl |
Laju konkurensi untuk eksekusi task. |
Json |
No |
{‘Mode’: ‘Concurrency’, ‘MaxErrors’: 100, ‘Concurrency’: 10} |
|
|
OOSAssumeRole |
Peran RAM yang diasumsikan oleh OOS. |
String |
No |
OOSServiceRole |
Parameter respons
|
Nama parameter |
Deskripsi |
Tipe |
|
allThresholdInfo |
List |
Kebijakan akses yang diperlukan untuk templat ini
{
"Version": "1",
"Statement": [
{
"Action": [
"ess:DescribeScalingGroups",
"ess:DescribeScalingInstances"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeSpotPriceHistory"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Detail
Detail ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes
Konten templat
FormatVersion: OOS-2019-06-01
Description:
en: 'Monitors the discounts and prices of existing spot instances in the scaling group. Sends an alert notification if the values exceed the specified threshold.'
zh-cn: 'Monitors the discounts and prices of existing spot instances in the scaling group. Sends an alert notification if the actual value exceeds the threshold.'
name-en: ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes
name-zh-cn: 'Sends an alert when the price or discount of existing instance types in a scaling group exceeds a threshold.'
Parameters:
region:
Type: String
Label:
en: RegionId
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
scalingGroupId:
Description:
en: ScalingGroupId
zh-cn: The ID of the Auto Scaling group.
Label:
en: scalingGroupId
zh-cn: Scaling Group ID
Type: List
taskType:
Description:
en: 'The type of monitoring task. Valid values: Discount (monitors discount) and Price (monitors price).'
zh-cn: 'The type of monitoring task. Valid values: Discount (monitors discount) and Price (monitors price).'
Label:
en: TaskType
zh-cn: Monitoring Task Type
Type: String
Default: Discount
AllowedValues:
- Discount
- Price
threshold:
Description:
en: 'The price or discount threshold. For discounts, the value represents the percentage of the pay-as-you-go price. For example, 10 means the spot price is 10% of the pay-as-you-go price. For prices, enter the price threshold directly.'
zh-cn: 'The price or discount threshold. For discounts, the value represents the percentage of the pay-as-you-go price. For example, 10 means the spot price is 10% of the pay-as-you-go price. For prices, enter the price threshold directly.'
Label:
en: Threshold
zh-cn: Price/Discount Threshold
Type: Number
webhook:
Description:
en: 'example:https://oapi.dingtalk.com/robot/send?access_token=bac51db2e39418ec6c2dbb27fd111bc7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.'
zh-cn: 'Example: https://oapi.dingtalk.com/robot/send?access_token=bac51db2e39418ec6c2dbb27fd111bc7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.'
Label:
en: Webhook
zh-cn: 'The webhook URL for DingTalk notifications.'
Type: String
rateControl:
Label:
en: RateControl
zh-cn: Task Execution Concurrency Rate
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 100
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: The RAM role that OOS assumes.
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: describeScalingGroups
Action: 'ACS::ExecuteAPI'
Description:
en: Queries the scaling groups.
zh-cn: Queries the Auto Scaling groups.
Properties:
Service: ESS
API: DescribeScalingGroups
Parameters:
RegionId: '{{ region }}'
ScalingGroupId1: '{{ ACS::TaskLoopItem }}'
Outputs:
scalingGroupInfo:
Type: String
ValueSelector: '.ScalingGroups.ScalingGroup[].ScalingGroupId'
Loop:
Items: '{{ scalingGroupId }}'
RateControl: '{{ rateControl }}'
Outputs:
scalingGroupInfos:
AggregateType: 'Fn::ListJoin'
AggregateField: scalingGroupInfo
- Name: wetherOutPutPriceInfo
Action: 'ACS::Choice'
Description:
en: Checks whether the scaling group exists.
zh-cn: Checks whether the scaling group exists.
Properties:
DefaultTask: scalingGroupMonitorInfos
Choices:
- When:
'Fn::Equals':
- []
- 'Fn::MergeList': '{{ describeScalingGroups.scalingGroupInfos }}'
NextTask: 'ACS::END'
- Name: scalingGroupMonitorInfos
Action: 'ACS::ECS::AlarmSpotPriceOrDiscountBySingleScalingGroup'
Description:
en: Monitors the discount or price of the instance types in the scaling group.
zh-cn: Monitors the discount or price of the instance types in the Auto Scaling group.
Properties:
regionId: '{{region}}'
threshold: '{{ threshold }}'
taskType: '{{ taskType }}'
scalingGroupId: '{{ ACS::TaskLoopItem }}'
Outputs:
monitorInfo:
Type: String
ValueSelector: singleMonitorInfo
Loop:
Items: '{{ scalingGroupId }}'
RateControl: '{{ rateControl }}'
Outputs:
allMonitorInfo:
AggregateField: monitorInfo
AggregateType: 'Fn::ListJoin'
- Name: wetherNodifyWebhook
Action: 'ACS::Choice'
Description:
en: Checks whether an alert notification is required.
zh-cn: Checks whether an alert notification needs to be sent.
Properties:
DefaultTask: alarmNotify
Choices:
- When:
'Fn::Equals':
- []
- 'Fn::MergeList':
- '{{ scalingGroupMonitorInfos.allMonitorInfo }}'
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 }}
- 'Fn::Jq':
- First
- . | join("\n\n")
- 'Fn::MergeList':
- '{{ scalingGroupMonitorInfos.allMonitorInfo }}'
Outputs:
allThresholdInfo:
Type: List
Value:
'Fn::Join':
- ''
- 'Fn::ListJoin':
- |
### Alarm threshold (%): {{ threshold }}
- 'Fn::Jq':
- First
- . | join("\n\n")
- 'Fn::MergeList':
- '{{ scalingGroupMonitorInfos.allMonitorInfo }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- region
- scalingGroupId
- taskType
- threshold
- webhook
Label:
default:
zh-cn: Configure Parameters
en: Configure Parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced Options
en: Advanced Options