ACS-ECS-ScheduleToExecuteDiagnosticReports.md
Blame歷史原始文件固定地址
編輯
模板名稱
ACS-ECS-ScheduleToExecuteDiagnosticReports 定時執行ECS健康診斷
模板描述
定時運行ECS健康診斷
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 默認值 | 約束 |
targets | ECS實例 | Json | 是 | ||
timerTrigger | 定時類型 | Json | 否 | {‘expression’: ‘0 0 1 ? * *’, ‘endDate’: ‘2099-12-01T00:00:00Z’, ‘type’: ‘cron’, ‘timeZone’: ‘Asia/Shanghai’} | |
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
whetherNotify | 是否通知異常結果 | Boolean | 否 | False | |
notifyURI | 通知地址 | String | 否 | “” | |
notifyAt | 通知@ | String | 否 | “” | |
rateControl | 任務執行的并發比率 | Json | 否 | {‘Mode’: ‘Concurrency,’, ‘MaxErrors’: ‘0,’, ‘Concurrency’: 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | “” |
輸出參數
參數名稱 | 描述 | 類型 |
metricResults | Json |
執行此模板需要的權限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CreateDiagnosticReport",
"ecs:DescribeDiagnosticReportAttributes",
"ecs:DescribeInstances"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-ECS-ScheduleToExecuteDiagnosticReports詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
en: Schedules to execute ECS diagnostic reports in bulk
zh-cn: 定時運行ECS健康診斷
name-en: ACS-ECS-ScheduleToExecuteDiagnosticReports
name-zh-cn: 定時執行ECS健康診斷
categories:
- time_trigger
Parameters:
timerTrigger:
Type: Json
Label:
en: TimerTrigger
zh-cn: 定時類型
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: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Description: ECS實例
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
whetherNotify:
Type: Boolean
Description: 是否通知
Default: false
Label:
en: whether notify
zh-cn: 是否通知異常結果
notifyURI:
Type: String
Description: 通知WebHook
AssociationProperty: TextArea
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${whetherNotify}
- true
Label:
en: notify uri
zh-cn: 通知地址
Default: ''
notifyAt:
Type: String
Description: 通知@人員
AssociationProperty: TextArea
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${whetherNotify}
- true
Label:
en: notify@
zh-cn: 通知@
Default: ''
rateControl:
Description: 任務執行的并發比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency,
MaxErrors: 0,
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
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: 通過指定觸發類型和表達式按計劃觸發任務
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone: Asia/Shanghai
Outputs: {}
- Name: getInstances
Description:
en: Views the ECS instances
zh-cn: 獲取ECS實例
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: 創建ECS實例診斷報告
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: wheatherNotify
Action: ACS::Choice
Description:
en: wheather notify
zh-cn: 通知選擇
Properties:
DefaultTask: notify
Choices:
- When:
Fn::Equals:
- false
- '{{ whetherNotify }}'
NextTask: ACS::END
- Name: notify
Action: ACS::Notify
Description: 通知有異常Issue的診斷報告鏈接
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: 設置周期參數(必填)
en: Configure Parameters
- Parameters:
- regionId
- targets
- rateControl
Label:
default:
zh-cn: 設置地域、所選實例、并發個數(必填)
en: Configure Parameters
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: 設置執行的RAM角色(必填)
en: Configure Parameters
- Parameters:
- whetherNotify
- notifyURI
- notifyAt
Label:
default:
zh-cn: 設置類釘釘的參數(選填)
en: Configure Parameters
文檔內容是否對您有幫助?