ACS-ECS-ScheduleToExecuteDiagnosticReports.md
ファイル履歴へのパーマリンク
変更
テンプレート名
ACS-ECS-ScheduleToExecuteDiagnosticReports 定期的な ECS ヘルス診断の実行
テンプレートの説明
スケジュールに従って Elastic Compute Service (ECS) インスタンスの診断レポートを作成します。
テンプレートの種類
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター名 | 説明 | 種類 | 必須 | デフォルト値 | 制限 |
targets | ターゲットインスタンス。 | 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 | CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。 | String | いいえ | "" |
出力パラメーター
パラメーター | 説明 | 種類 |
metricResults | Json |
テンプレートの実行に必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CreateDiagnosticReport",
"ecs:DescribeDiagnosticReportAttributes",
"ecs:DescribeInstances"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
ACS-ECS-ScheduleToExecuteDiagnosticReports の詳細
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: ECS 診断レポートをまとめて実行するようにスケジュールします
zh-cn: ECS インスタンスのヘルス診断をスケジュールします
name-en: ACS-ECS-ScheduleToExecuteDiagnosticReports
name-zh-cn: ECS インスタンスのヘルス診断をスケジュールします
categories:
- time_trigger
Parameters:
timerTrigger:
Type: Json
Label:
en: タイマートリガー
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: リージョン ID
zh-cn: リージョン ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Label:
en: ターゲットインスタンス
zh-cn: ターゲットインスタンス
Type: Json
Description: ECS インスタンス。
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
whetherNotify:
Type: Boolean
Description: 通知を送信するかどうかを指定します。
Default: false
Label:
en: 通知するかどうか
zh-cn: 異常な結果を通知
notifyURI:
Type: String
Description: 通知 Webhook
AssociationProperty: TextArea
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${whetherNotify}
- true
Label:
en: 通知 URI
zh-cn: 通知アドレス
Default: ''
notifyAt:
Type: String
Description: アットマーク (@) を付けて通知するユーザー。
AssociationProperty: TextArea
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${whetherNotify}
- true
Label:
en: 通知@
zh-cn: 通知 @
Default: ''
rateControl:
Label:
en: レート制御
zh-cn: タスク実行の同時実行数
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: タイプと式を指定して、スケジュールどおりにタスクをトリガーします
zh-cn: 指定されたタイプと式に基づいて、スケジュールどおりにタスクをトリガーします。
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: ECS インスタンスを表示します
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: ECS インスタンスの診断レポートを作成します
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: whetherNotify
Action: ACS::Choice
Description:
en: 通知するかどうか
zh-cn: 通知の選択
Properties:
DefaultTask: notify
Choices:
- When:
Fn::Equals:
- false
- '{{ whetherNotify }}'
NextTask: ACS::END
- Name: notify
Action: ACS::Notify
Description: 異常な問題が含まれている場合、診断レポートへのリンクを含む通知を送信します。
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: パラメーターの設定
- Parameters:
- regionId
- targets
- rateControl
Label:
default:
zh-cn: リージョン、ターゲットインスタンス、同時実行数の設定 (必須)
en: パラメーターの設定
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: 実行 RAM ロールの設定 (必須)
en: パラメーターの設定
- Parameters:
- whetherNotify
- notifyURI
- notifyAt
Label:
default:
zh-cn: DingTalk 風パラメーターの設定 (任意)
en: パラメーターの設定