Nom du modèle
ACS-ECS-RunCommandWhenDiskUsageLimitExceeded
Description du modèle
Exécute une commande lorsque l'utilisation du disque sur une instance Elastic Compute Service (ECS) dépasse un seuil spécifié.
Type de modèle
Automatisé
Propriétaire
Alibaba Cloud
Paramètres d'entrée
|
Paramètre |
Description |
Type |
Obligatoire |
Valeur par défaut |
Limite |
|
instanceId |
Instance ECS dont vous souhaitez surveiller l'utilisation du disque. |
String |
Oui |
||
|
threshold |
Seuil d'utilisation du disque. |
String |
Oui |
||
|
diskPartition |
Partition de disque à surveiller. |
String |
Oui |
||
|
commandType |
Langage de script de la commande Cloud Assistant. |
String |
Oui |
||
|
commandToRun |
Commande à exécuter lorsque l'utilisation du disque dépasse le seuil. |
String |
Oui |
||
|
tags |
Tags de l'instance ECS. |
Json |
Non |
[] |
|
|
silenceTime |
Période de silence durant laquelle une seule notification d'alerte est envoyée en cas de dépassements répétés du seuil d'utilisation du disque. Unité : secondes. |
Number |
Non |
300 |
|
|
OOSAssumeRole |
Rôle RAM assumé par CloudOps Orchestration Service (OOS). |
String |
Non |
"" |
Paramètres de sortie
|
Paramètre |
Description |
Type |
|
instanceId |
String |
|
|
commandOutput |
String |
Politique d'autorisation requise pour exécuter le modèle
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Références
Pour plus d'informations, consultez ACS-ECS-RunCommandWhenDiskUsageLimitExceeded.yml sur GitHub.
Contenu du modèle
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