forked from aliyun/oos-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACS-ECS-RunCommandWhenDiskUsageLimitExceeded.json
126 lines (126 loc) · 4.23 KB
/
ACS-ECS-RunCommandWhenDiskUsageLimitExceeded.json
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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"en": "Run command when disk usage limit is exceeded.",
"zh-cn": "\u5f53\u67d0\u78c1\u76d8\u4f7f\u7528\u7387\u8fc7\u9ad8\u65f6\u6267\u884c\u67d0\u547d\u4ee4\u3002",
"name-en": "ACS-ECS-RunCommandWhenDiskUsageLimitExceeded",
"name-zh-cn": "\u5f53\u67d0\u78c1\u76d8\u4f7f\u7528\u7387\u8d85\u8fc7\u9608\u503c\u65f6\u6267\u884c\u547d\u4ee4\u3002",
"categories": [
"alarm-trigger"
]
},
"Parameters": {
"instanceId": {
"Type": "String",
"Description": {
"en": "The ECS instance ID to be monitored.",
"zh-cn": "\u5c06\u8981\u76d1\u63a7\u7684\u5b9e\u4f8b\u3002"
}
},
"threshold": {
"Type": "String",
"Description": {
"en": "The threshold of diskusage_utilization,e.g. 80 means 80%.",
"zh-cn": "\u78c1\u76d8\u4f7f\u7528\u7387\u9608\u503c\uff0c\u598280\uff0c\u5219\u610f\u5473\u774080%\u7684\u78c1\u76d8\u4f7f\u7528\u7387\u3002"
}
},
"diskPartition": {
"Type": "String",
"Description": {
"en": "disk partition to monitor, e.g.\"/dev/vda1\"or\"C:\\\\\".",
"zh-cn": "\u8981\u76d1\u63a7\u7684\u78c1\u76d8\u5206\u533a\u540d\u79f0\uff0c\u5982/dev/vda1\u6216\u8005C:\\\\\u3002"
}
},
"commandType": {
"Description": {
"en": "The type of cloud assistant command.",
"zh-cn": "\u4e91\u52a9\u624b\u6267\u884c\u7684\u8fd0\u7ef4\u811a\u672c\u7684\u8bed\u8a00\u7c7b\u578b\u3002"
},
"Type": "String",
"AllowedValues": [
"RunShellScript",
"RunBatScript",
"RunPowerShellScript"
]
},
"commandToRun": {
"Type": "String",
"Description": {
"en": "The command to run when disk usage exceeds threshold.",
"zh-cn": "\u5f53\u78c1\u76d8\u4f7f\u7528\u91cf\u8d85\u8fc7\u9608\u503c\u65f6\uff0c\u60a8\u6253\u7b97\u6267\u884c\u7684\u547d\u4ee4\u3002"
}
},
"silenceTime": {
"Type": "Number",
"Description": {
"en": "The silence time of alarm (seconds).",
"zh-cn": "\u544a\u8b66\u901a\u9053\u6c89\u9ed8\u5468\u671f\uff08\u79d2\uff09\uff0c\u5f53\u76d1\u63a7\u6570\u636e\u6301\u7eed\u8d85\u8fc7\u62a5\u8b66\u89c4\u5219\u9608\u503c\u65f6\uff0c\u6bcf\u4e2a\u6c89\u9ed8\u5468\u671f\u5185\u53ea\u53d1\u90011\u6b21\u62a5\u8b66\u901a\u77e5\u3002"
},
"Default": 300
},
"OOSAssumeRole": {
"Description": {
"en": "The RAM role to be assumed by OOS.",
"zh-cn": "OOS\u626e\u6f14\u7684RAM\u89d2\u8272\u3002"
},
"Type": "String",
"Default": "OOSServiceRole"
}
},
"RamRole": "{{ OOSAssumeRole }}",
"Tasks": [
{
"Name": "alarmTrigger",
"Action": "ACS::AlarmTrigger",
"Description": {
"en": "Set the diskusage_utilization alarm for specified disk partition.",
"zh-cn": "\u8bbe\u7f6e\u5bf9\u67d0\u78c1\u76d8\u5206\u533a\u7684\u4f7f\u7528\u7387\u8fdb\u884c\u76d1\u63a7\u3002"
},
"Properties": {
"Namespace": "acs_ecs_dashboard",
"MetricName": "diskusage_utilization",
"Statistics": "Maximum",
"ComparisonOperator": "GreaterThanThreshold",
"Threshold": "{{threshold}}",
"Resources": "[{\"instanceId\":\"{{ instanceId }}\",\"device\":\"{{ diskPartition }}\"}]",
"Times": 1,
"SilenceTime": "{{silenceTime}}"
},
"Outputs": {
"instanceId": {
"Type": "String",
"ValueSelector": ".instanceId"
}
}
},
{
"Name": "runCommand",
"Action": "ACS::ECS::RunCommand",
"Description": {
"en": "Run cloud assistant command on ECS instance.",
"zh-cn": "\u5728\u5b9e\u4f8b\u4e2d\u8fd0\u884c\u4e91\u52a9\u624b\u547d\u4ee4\u3002"
},
"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 }}"
}
}
}