-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS-ECS-RunCommandWhenDiskUsageLimitExceeded.yml
141 lines (141 loc) · 3.85 KB
/
ACS-ECS-RunCommandWhenDiskUsageLimitExceeded.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
FormatVersion: OOS-2019-06-01
Description:
en: Run command when disk usage limit is exceeded
zh-cn: 当某磁盘使用率过高时执行某命令
name-en: ACS-ECS-RunCommandWhenDiskUsageLimitExceeded
name-zh-cn: 当某磁盘使用率超过阈值时执行命令
categories:
- alarm-trigger
Parameters:
instanceId:
Type: String
Label:
en: InstanceId
zh-cn: 将要监控的实例
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: '{{ ACS::RegionId }}'
threshold:
Type: String
Description:
en: e.g. 80 means 80%
zh-cn: 例如80,则意味着80%的磁盘使用率
Label:
en: Threshold
zh-cn: 磁盘使用率阈值
diskPartition:
Type: String
Description:
en: e.g."/dev/vda1"or"C:\\"
zh-cn: 如/dev/vda1或者C:\\
Label:
en: DiskPartition
zh-cn: 要监控的磁盘分区名称
commandType:
Label:
en: CommandType
zh-cn: 云助手执行的运维脚本的语言类型
Type: String
AllowedValues:
- RunShellScript
- RunBatScript
- RunPowerShellScript
tags:
Type: Json
Label:
en: Tags
zh-cn: 实例的标签
AssociationProperty: Tags
Default: []
commandToRun:
Type: String
Label:
en: CommandToRun
zh-cn: 当磁盘使用量超过阈值时执行的命令
silenceTime:
Type: Number
Description:
en: When the monitoring data continues to exceed the alarm rule threshold, only one alarm notification will be sent in each silent period
zh-cn: 当监控数据持续超过报警规则阈值时,每个沉默周期内只发送1次报警通知
Label:
en: CilenceTime
zh-cn: 告警通道沉默周期(秒)
Default: 300
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: alarmTrigger
Action: 'ACS::AlarmTrigger'
Description:
en: Set the diskusage_utilization alarm for specified disk partition
zh-cn: 设置对某磁盘分区的使用率进行监控
Properties:
Namespace: 'acs_ecs_dashboard'
MetricName: 'diskusage_utilization'
Statistics: 'Maximum'
ComparisonOperator: 'GreaterThanThreshold'
Threshold: '{{threshold}}'
Resources: '[{"instanceId":"{{ instanceId }}","device":"{{ diskPartition }}"}]'
Times: 1
SilenceTime: '{{silenceTime}}'
Tags: '{{ tags }}'
Outputs:
instanceId:
Type: String
ValueSelector: .instanceId
- Name: runCommand
Action: ACS::ECS::RunCommand
Description:
en: Run cloud assistant command on ECS instance
zh-cn: 在实例中运行云助手命令
Properties:
commandContent: '{{ commandToRun }}'
commandType: '{{ commandType }}'
instanceId: '{{ instanceId }}'
Outputs:
commandOutput:
Type: String
ValueSelector: invocationOutput
Outputs:
instanceId:
Value: '{{ alarmTrigger.instanceId }}'
Type: String
commandOutput:
Type: String
Value: '{{ runCommand.commandOutput }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- instanceId
Label:
default:
zh-cn: 实例选择
en: Select ECS Instance
- Parameters:
- threshold
- diskPartition
- silenceTime
- tags
Label:
default:
zh-cn: 告警配置
en: Alarm Configure
- Parameters:
- commandType
- commandToRun
Label:
default:
zh-cn: 执行命令选型
en: Run Command Options
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: 高级选项
en: Control Options