-
Notifications
You must be signed in to change notification settings - Fork 1
/
arm-template.json
124 lines (124 loc) · 4.12 KB
/
arm-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
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
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"type": "string"
},
"adminEmail": {
"type": "string"
}
},
"variables": {
"insights": "[concat(parameters('appName'), '-insights')]",
"queryDataSource": "[resourceId('microsoft.insights/components', variables('insights'))]",
"odataType": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
"actionGroups": "[array(concat('/subscriptions/a7b6f428-0ed2-4721-9548-d17c361d9b77/resourceGroups/', parameters('appName'), '/providers/microsoft.insights/actiongroups/Email'))]",
"northEuropeLocation": "northeurope"
},
"resources": [
{
"type": "Microsoft.Insights/actionGroups",
"name": "Email",
"apiVersion": "2018-03-01",
"location": "Global",
"properties": {
"groupShortName": "Email",
"enabled": true,
"emailReceivers": [
{
"name": "Send Email_-EmailAction-",
"emailAddress": "[parameters('adminEmail')]"
}
]
}
},
{
"type": "Microsoft.Insights/components",
"kind": "web",
"name": "[variables('insights')]",
"location": "[variables('northEuropeLocation')]",
"apiVersion": "2014-04-01",
"scale": null,
"properties": {
"name": "[variables('insights')]"
}
},
{
"type": "Microsoft.Insights/scheduledQueryRules",
"name": "Exceptions",
"apiVersion": "2018-04-16",
"location": "[variables('northEuropeLocation')]",
"tags": {
"[concat('hidden-link:/subscriptions/a7b6f428-0ed2-4721-9548-d17c361d9b77/resourcegroups/', parameters('appName'), '/providers/microsoft.insights/components/', variables('insights'))]": "Resource"
},
"properties": {
"description": "Any exceptions happening in the app",
"enabled": "true",
"source": {
"query": "exceptions",
"authorizedResources": [],
"dataSourceId": "[variables('queryDataSource')]",
"queryType": "ResultCount"
},
"schedule": {
"frequencyInMinutes": 5,
"timeWindowInMinutes": 5
},
"action": {
"odata.type": "[variables('odataType')]",
"severity": "4",
"aznsAction": {
"actionGroup": "[variables('actionGroups')]",
"emailSubject": "Check Your Exceptions"
},
"trigger": {
"thresholdOperator": "GreaterThan",
"threshold": 0
}
}
},
"dependsOn": [
"[resourceId('microsoft.insights/components', variables('insights'))]"
]
},
{
"type": "Microsoft.Insights/scheduledQueryRules",
"name": "Requests",
"apiVersion": "2018-04-16",
"location": "[variables('northEuropeLocation')]",
"tags": {
"[concat('hidden-link:/subscriptions/a7b6f428-0ed2-4721-9548-d17c361d9b77/resourcegroups/', parameters('appName'), '/providers/microsoft.insights/components/', variables('insights'))]": "Resource"
},
"properties": {
"description": "All the requests sent to the service",
"enabled": "true",
"source": {
"query": "requests | where operation_Name startswith 'GET /api/'",
"authorizedResources": [],
"dataSourceId": "[variables('queryDataSource')]",
"queryType": "ResultCount"
},
"schedule": {
"frequencyInMinutes": 30,
"timeWindowInMinutes": 30
},
"action": {
"odata.type": "[variables('odataType')]",
"severity": "2",
"aznsAction": {
"actionGroup": "[variables('actionGroups')]",
"emailSubject": "Check Your Requests"
},
"trigger": {
"thresholdOperator": "GreaterThan",
"threshold": 0
}
}
},
"dependsOn": [
"[resourceId('microsoft.insights/components', variables('insights'))]"
]
}
]
}