-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavailabilityalert.json
105 lines (105 loc) · 4.61 KB
/
availabilityalert.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
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"type": "string"
},
"pingURL": {
"type": "string"
},
"pingText": {
"type": "string",
"defaultValue": ""
},
"actionGroupId": {
"type": "string"
},
"location": {
"type": "string"
},
"alertName":{
"type": "string"
}
},
"variables": {
"pingTestName": "[toLower(parameters('alertName'))]",
"pingAlertRuleName": "[concat(toLower(parameters('alertName')), '-', subscription().displayName)]"
},
"resources": [
{
"name": "[variables('pingTestName')]",
"type": "Microsoft.Insights/webtests",
"apiVersion": "2014-04-01",
"location": "[parameters('location')]",
"tags": {
"[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource"
},
"properties": {
"Name": "[variables('pingTestName')]",
"Description": "Basic ping test",
"Enabled": true,
"Frequency": 300,
"Timeout": 120,
"Kind": "ping",
"RetryEnabled": true,
"Locations": [
{
"Id": "emea-nl-ams-azr"
},
{
"Id": "us-ca-sjc-azr"
},
{
"Id": "us-tx-sn1-azr"
},
{
"Id": "us-va-ash-azr"
},
{
"Id": "us-fl-mia-edge"
}
],
"Configuration": {
"WebTest": "[concat('<WebTest Name=\"', variables('pingTestName'), '\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\"> <Items> <Request Method=\"GET\" Version=\"1.1\" Url=\"', parameters('pingURL'), '\" ThinkTime=\"0\" Timeout=\"300\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /> </Items> <ValidationRules> <ValidationRule Classname=\"Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" DisplayName=\"Find Text\" Description=\"Verifies the existence of the specified text in the response.\" Level=\"High\" ExecutionOrder=\"BeforeDependents\"> <RuleParameters> <RuleParameter Name=\"FindText\" Value=\"', parameters('pingText'), '\" /> <RuleParameter Name=\"IgnoreCase\" Value=\"False\" /> <RuleParameter Name=\"UseRegularExpression\" Value=\"False\" /> <RuleParameter Name=\"PassIfTextFound\" Value=\"True\" /> </RuleParameters> </ValidationRule> </ValidationRules> </WebTest>')]"
},
"SyntheticMonitorId": "[variables('pingTestName')]"
}
},
{
"name": "[variables('pingAlertRuleName')]",
"type": "Microsoft.Insights/metricAlerts",
"apiVersion": "2018-03-01",
"location": "global",
"dependsOn": [
"[resourceId('Microsoft.Insights/webtests', variables('pingTestName'))]"
],
"tags": {
"[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource",
"[concat('hidden-link:', resourceId('Microsoft.Insights/webtests', variables('pingTestName')))]": "Resource"
},
"properties": {
"description": "Alert for web test",
"severity": 1,
"enabled": true,
"scopes": [
"[resourceId('Microsoft.Insights/webtests',variables('pingTestName'))]",
"[resourceId('Microsoft.Insights/components',parameters('appName'))]"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT5M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
"webTestId": "[resourceId('Microsoft.Insights/webtests', variables('pingTestName'))]",
"componentId": "[resourceId('Microsoft.Insights/components', parameters('appName'))]",
"failedLocationCount": 2
},
"actions": [
{
"actionGroupId": "[parameters('actionGroupId')]"
}
]
}
}
]
}