Todos os produtos
Search
Central de documentação

CloudOps Orchestration Service:ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes

Última atualização: Jun 28, 2026

Nome do modelo

ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes - Envia um alerta quando o preço ou desconto de um tipo de instância existente em um grupo de dimensionamento ultrapassa um limiar.

Executar agora

Descrição do modelo

Monitora descontos e preços de instâncias preemptíveis existentes em um grupo de dimensionamento e envia um alerta se algum valor exceder o limiar especificado.

Tipo de modelo

Automation

Proprietário

Alibaba Cloud

Parâmetros de entrada

Nome do parâmetro

Descrição

Tipo

Obrigatório

Valor padrão

Restrições

scalingGroupId

ID do grupo de dimensionamento.

List

Sim

threshold

Limiar de preço ou desconto.

Number

Sim

webhook

URL do webhook do chatbot do DingTalk para recebimento de mensagens.

String

Sim

region

ID da região.

String

Não

{{ ACS::RegionId }}

taskType

Tipo de tarefa de monitoramento.

String

Não

Discount

rateControl

Taxa de concorrência para execução da tarefa.

Json

Não

{‘Mode’: ‘Concurrency’, ‘MaxErrors’: 100, ‘Concurrency’: 10}

OOSAssumeRole

Função RAM assumida pelo OOS.

String

Não

OOSServiceRole

Parâmetros de resposta

Nome do parâmetro

Descrição

Tipo

allThresholdInfo

List

Política de acesso necessária para este modelo

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ess:DescribeScalingGroups",
                "ess:DescribeScalingInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:DescribeSpotPriceHistory"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Detalhes

Detalhes do ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes

Conteúdo do modelo

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