全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ECS-ScheduleToExecuteDiagnosticReports

更新时间:Dec 21, 2025

ACS-ECS-ScheduleToExecuteDiagnosticReports.md

Permalink ke file blame

Ubah

Nama template

ACS-ECS-ScheduleToExecuteDiagnosticReports: Menjalankan diagnostik kesehatan ECS secara terjadwal

Eksekusi Sekarang

Deskripsi template

Membuat laporan diagnostik untuk instance Elastic Compute Service (ECS) berdasarkan jadwal yang telah ditentukan.

Tipe template

Otomatis

Pemilik

Alibaba Cloud

Parameter masukan

Nama Parameter

Deskripsi

Tipe

Diperlukan

Nilai default

Batasan

targets

Instans target.

Json

Ya

timerTrigger

Tipe tugas terjadwal.

Json

Tidak

{'expression': '0 0 1 ? * *', 'endDate': '2099-12-01T00:00:00Z', 'type': 'cron', 'timeZone': 'Asia/Shanghai'}

regionId

ID wilayah.

String

Tidak

{{ ACS::RegionId }}

whetherNotify

Menentukan apakah akan mengirim notifikasi jika pengecualian terdeteksi.

Boolean

Tidak

False

notifyURI

Titik akhir notifikasi

String

Tidak

""

notifyAt

@Mentions

String

Tidak

""

rateControl

Konkurensi Eksekusi Tugas

Json

Tidak

{'Mode': 'Concurrency,', 'MaxErrors': '0,', 'Concurrency': 10}

OOSAssumeRole

Peran Resource Access Management (RAM) yang diasumsikan oleh CloudOps Orchestration Service (OOS).

String

Tidak

""

Parameter keluaran

Parameter

Deskripsi

Tipe

metricResults

Json

Kebijakan izin yang diperlukan untuk mengeksekusi template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateDiagnosticReport",
                "ecs:DescribeDiagnosticReportAttributes",
                "ecs:DescribeInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Rincian

Detail ACS-ECS-ScheduleToExecuteDiagnosticReports

Konten Template

FormatVersion: OOS-2019-06-01
Description:
  en: Schedules to execute ECS diagnostic reports in bulk
  zh-cn: Schedules health diagnostics for ECS instances
  name-en: ACS-ECS-ScheduleToExecuteDiagnosticReports
  name-zh-cn: Schedule health diagnostics for ECS instances
  categories:
    - time_trigger
Parameters:
  timerTrigger:
    Type: Json
    Label:
      en: TimerTrigger
      zh-cn: Schedule type
    AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
    AssociationPropertyMetadata:
      MinuteInterval: 30
    Default:
      expression: 0 0 1 ? * *
      endDate: '2099-12-01T00:00:00Z'
      type: cron
      timeZone: Asia/Shanghai
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Label:
      en: TargetInstance
      zh-cn: Target instance
    Type: Json
    Description: The ECS instances.
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: ALIYUN::ECS::Instance
      RegionId: regionId
  whetherNotify:
    Type: Boolean
    Description: Specifies whether to send notifications.
    Default: false
    Label:
      en: whether notify
      zh-cn: Notify on abnormal results
  notifyURI:
    Type: String
    Description: Notification webhook
    AssociationProperty: TextArea
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${whetherNotify}
            - true
    Label:
      en: notify uri
      zh-cn: Notification address
    Default: ''
  notifyAt:
    Type: String
    Description: The users to notify with an at sign (@).
    AssociationProperty: TextArea
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${whetherNotify}
            - true
    Label:
      en: notify@
      zh-cn: Notify @
    Default: ''
  rateControl:
    Label:
      en: RateControl
      zh-cn: Task execution concurrency
    Description: The concurrency rate for task execution.
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency,
      MaxErrors: 0,
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role assumed by OOS
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: timerTrigger
    Action: ACS::TimerTrigger
    Description:
      en: Triggers a task as scheduled by specifying type and expression
      zh-cn: Triggers a task on a schedule based on the specified type and expression.
    Properties:
      Type:
        Fn::Select:
          - type
          - '{{timerTrigger}}'
      Expression:
        Fn::Select:
          - expression
          - '{{timerTrigger}}'
      StartDate:
        Fn::Select:
          - startDate
          - '{{ timerTrigger }}'
      EndDate:
        Fn::Select:
          - endDate
          - '{{ timerTrigger }}'
      TimeZone: Asia/Shanghai
    Outputs: {}
  - Name: getInstances
    Description:
      en: Views the ECS instances
      zh-cn: Gets the ECS instances.
    Action: ACS::SelectTargets
    Properties:
      ResourceType: ALIYUN::ECS::Instance
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: Instances.Instance[].InstanceId
  - Name: createDiagnosticReports
    Action: ACS::ECS::CreateDiagnoseReport
    Description:
      en: Create diagnostic report for ECS instance
      zh-cn: Creates a diagnostic report for the ECS instance.
    Properties:
      regionId: '{{ regionId }}'
      resourceId: '{{ ACS::TaskLoopItem }}'
      metricSetId: dms-instancedefault
    Loop:
      Items: '{{ getInstances.instanceIds }}'
      Outputs:
        metricResults:
          AggregateType: Fn::ListJoin
          AggregateField: metricResult
      RateControl:
        MaxErrors: 0
        Mode: Concurrency
        Concurrency: 1
    Outputs:
      metricResult:
        Type: Json
        ValueSelector: .metricResults | .MetricResult = (.MetricResult[] | select(.Issues.Issue | length > 0))
  - Name: whetherNotify
    Action: ACS::Choice
    Description:
      en: whether notify
      zh-cn: Notification choice
    Properties:
      DefaultTask: notify
      Choices:
        - When:
            Fn::Equals:
              - false
              - '{{ whetherNotify }}'
          NextTask: ACS::END
  - Name: notify
    Action: ACS::Notify
    Description: Sends a notification with a link to the diagnostic report if it contains abnormal issues.
    Properties:
      NotifyType: WebHook
      WebHook:
        URI: '{{ notifyURI }}'
        Headers:
          Content-Type: application/json
        Content:
          msgtype: text
          text:
            type: Json
            content: '{{ createDiagnosticReports.metricResults }}'
          At: '{{ notifyAt }}'
    Outputs: {}
Outputs:
  metricResults:
    Type: Json
    Value: '{{ createDiagnosticReports.metricResults }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - timerTrigger
        Label:
          default:
            zh-cn: Set schedule parameters (Required)
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
          - rateControl
        Label:
          default:
            zh-cn: Set region, target instances, and concurrency (Required)
            en: Configure Parameters
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Set the execution RAM role (Required)
            en: Configure Parameters
      - Parameters:
          - whetherNotify
          - notifyURI
          - notifyAt
        Label:
          default:
            zh-cn: Set DingTalk-like parameters (Optional)
            en: Configure Parameters