-
Notifications
You must be signed in to change notification settings - Fork 0
/
alert_cpu_template.json
66 lines (66 loc) · 2.1 KB
/
alert_cpu_template.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
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachineName": {
"type": "string",
"metadata": {
"description": "Name of the Virtual Machine to create the alert for."
}
},
"actionGroupId": {
"type": "string",
"metadata": {
"description": "Resource ID of the action group to assign to this alert."
}
}
},
"variables": {
"alertName": "[concat('cpu_80_',parameters('virtualMachineName'))]",
"alertDescription": "Email when CPU greater than 80 percent for 5 min",
"resourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]",
"alertSeverity": 2,
"isEnabled": true,
"metricName": "Percentage CPU",
"operator": "GreaterThan",
"threshold": 80,
"timeAggregation": "Average",
"windowSize": "PT5M",
"evaluationFrequency": "PT1M"
},
"resources": [
{
"name": "[variables('alertName')]",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"apiVersion": "2018-03-01",
"tags": {},
"properties": {
"description": "[variables('alertDescription')]",
"severity": "[variables('alertSeverity')]",
"enabled": "[variables('isEnabled')]",
"scopes": [ "[variables('resourceId')]" ],
"evaluationFrequency": "[variables('evaluationFrequency')]",
"windowSize": "[variables('windowSize')]",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
"allOf": [
{
"name": "1st criterion",
"metricName": "[variables('metricName')]",
"dimensions": [],
"operator": "[variables('operator')]",
"threshold": "[variables('threshold')]",
"timeAggregation": "[variables('timeAggregation')]"
}
]
},
"actions": [
{
"actionGroupId": "[parameters('actionGroupId')]"
}
]
}
}
]
}