我有一个关于如何将 Runbook 操作添加到我的指标警报的问题,有很多关于向所有者发送电子邮件的文档,但没有一个说明操作 Runbook。
这是我创建指标警报的模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"AlertName": {
"type": "string"
},
"Description": {
"type": "string"
},
"VirtualMachineId": {
"type": "string"
},
"MetricName": {
"type": "string"
},
"Operator": {
"type": "string"
},
"Threshold": {
"type": "string"
},
"Aggregation": {
"type": "string"
},
"WindowSize": {
"type": "string"
}
},
"variables": {
},
"resources": [
{
"type": "microsoft.insights/alertRules",
"name": "[parameters('AlertName')]",
"location": "[resourceGroup().location]",
"apiVersion": "2016-03-01",
"properties": {
"name": "[parameters('AlertName')]",
"description": "[parameters('Description')]",
"isEnabled": "true",
"windowSize": "[parameters('WindowSize')]",
"condition": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"dataSource": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "[resourceId('Microsoft.Compute/virtualMachines',parameters('VirtualMachineId'))]",
"metricName": "[parameters('MetricName')]"
},
"operator": "[parameters('Operator')]",
"threshold": "[parameters('Threshold')]",
"windowSize": "[parameters('WindowSize')]",
"timeAggregation": "[parameters('Aggregation')]"
},
"actions": [
{
"odata.type": "RuleAction"
//Runbook....
}
]
}
}
]
}
没有关于添加 RuleAction 的文档,并且在使用 Json 模板创建虚拟机后我卡在了这一点上。
谢谢你。