Skip to content

Commit

Permalink
Support for Application Insights Availability Metric Alert
Browse files Browse the repository at this point in the history
Resolved issue:
Decommission of the classic alert
  • Loading branch information
sc-jiannannding authored Aug 30, 2019
1 parent c416b84 commit e14cb8e
Show file tree
Hide file tree
Showing 36 changed files with 3,336 additions and 4,068 deletions.
155 changes: 70 additions & 85 deletions Sitecore 8.2.1/xdb/addons/Monitoring/nested/availability.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"alertRuleApiVersion": "2016-03-01",
"applicationInsightsResourceName": "[concat(parameters('deploymentId'),'-ai')]",
"subscription": "[subscription().subscriptionId]",
"sitecoreResourceGroup": "[resourceGroup().name]"
"sitecoreResourceGroup": "[resourceGroup().name]",
"actionGroupResourceId": "[parameters('infrastructure').actionGroupName]"
},
"resources": [
{
Expand Down Expand Up @@ -68,50 +69,42 @@
"Configuration": {
"WebTest": "[concat('<WebTest Name=\"',parameters('deploymentId'),'-prc','-PingTest\" Enabled=\"True\" Timeout=\"120\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" > <Items> <Request Method=\"GET\" Version=\"1.1\" Url=\"https://',parameters('deploymentId'),'-prc','.azurewebsites.net/sitecore/service/keepalive.aspx\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"False\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" IgnoreHttpStatusCode=\"False\" /> </Items> </WebTest>') ]"
}
}
},
{
"type": "Microsoft.Insights/metricAlerts",
"apiVersion": "2018-03-01",
"name": "[concat(parameters('deploymentId'),'-prc','-pingWebTest-alert')]",
"location": "global",
"dependsOn": [
"[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-prc','-pingWebTest'))]"
],
"tags": {
"[concat('hidden-link:', resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName')))]": "Resource",
"[concat('hidden-link:', resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-prc','-pingWebTest')))]": "Resource"
},
"resources": [
{
"name": "[concat(parameters('deploymentId'),'-prc','-pingWebTest-alert')]",
"type": "microsoft.insights/alertrules",
"apiVersion": "[variables('alertRuleApiVersion')]",
"location": "[parameters('applicationInsightsLocation')]",
"dependsOn": [
"[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-prc','-pingWebTest'))]"
],
"tags": {
"[concat('hidden-link:', resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName')))]": "Resource",
"[concat('hidden-link:', resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-prc','-pingWebTest')))]": "Resource"
},
"properties": {
"name": "[concat(parameters('deploymentId'),'-prc','-pingWebTest-alert')]",
"description": "Alert to be triggered when the Web Test fails",
"isEnabled": true,
"condition": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition",
"datasource": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-prc','-pingWebTest'))]",
"metricName": "GSMT_AvRaW",
"resourceLocation": null,
"metricNamespace": null,
"legacyResourceId": null
},
"windowSize": "PT5M",
"failedLocationCount": 2
},
"actions": [
{
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"sendToServiceOwners": false,
"customEmails": "[split(parameters('omsWorkspaceAlertRecipients'),';')]"
}
]
"properties": {
"description": "Alert to be triggered when the Web Test fails",
"severity": 0,
"enabled": true,
"scopes": [
"[resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName'))]",
"[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-prc','-pingWebTest'))]"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT5M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
"webTestId": "[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-prc','-pingWebTest'))]",
"componentId": "[resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName'))]",
"failedLocationCount": "2"
},
"actions": [
{
"actionGroupId": "[resourceId('Microsoft.Insights/actionGroups', variables('actionGroupResourceId'))]"
}
}
]
]
}
},
{
"type": "Microsoft.Insights/webtests",
Expand Down Expand Up @@ -151,50 +144,42 @@
"Configuration": {
"WebTest": "[concat('<WebTest Name=\"',parameters('deploymentId'),'-rep','-PingTest\" Enabled=\"True\" Timeout=\"120\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" > <Items> <Request Method=\"GET\" Version=\"1.1\" Url=\"https://',parameters('deploymentId'),'-rep','.azurewebsites.net/sitecore/service/keepalive.aspx\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"False\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" IgnoreHttpStatusCode=\"False\" /> </Items> </WebTest>') ]"
}
}
},
{
"type": "Microsoft.Insights/metricAlerts",
"apiVersion": "2018-03-01",
"name": "[concat(parameters('deploymentId'),'-rep','-pingWebTest-alert')]",
"location": "global",
"dependsOn": [
"[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-rep','-pingWebTest'))]"
],
"tags": {
"[concat('hidden-link:', resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName')))]": "Resource",
"[concat('hidden-link:', resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-rep','-pingWebTest')))]": "Resource"
},
"resources": [
{
"name": "[concat(parameters('deploymentId'),'-rep','-pingWebTest-alert')]",
"type": "microsoft.insights/alertrules",
"apiVersion": "[variables('alertRuleApiVersion')]",
"location": "[parameters('applicationInsightsLocation')]",
"dependsOn": [
"[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-rep','-pingWebTest'))]"
],
"tags": {
"[concat('hidden-link:', resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName')))]": "Resource",
"[concat('hidden-link:', resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-rep','-pingWebTest')))]": "Resource"
},
"properties": {
"name": "[concat(parameters('deploymentId'),'-rep','-pingWebTest-alert')]",
"description": "Alert to be triggered when the Web Test fails",
"isEnabled": true,
"condition": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition",
"datasource": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-rep','-pingWebTest'))]",
"metricName": "GSMT_AvRaW",
"resourceLocation": null,
"metricNamespace": null,
"legacyResourceId": null
},
"windowSize": "PT5M",
"failedLocationCount": 2
},
"actions": [
{
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"sendToServiceOwners": false,
"customEmails": "[split(parameters('omsWorkspaceAlertRecipients'),';')]"
}
]
"properties": {
"description": "Alert to be triggered when the Web Test fails",
"severity": 0,
"enabled": true,
"scopes": [
"[resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName'))]",
"[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-rep','-pingWebTest'))]"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT5M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
"webTestId": "[resourceId('microsoft.insights/webtests/', concat(parameters('deploymentId'),'-rep','-pingWebTest'))]",
"componentId": "[resourceId('microsoft.insights/components/', variables('applicationInsightsResourceName'))]",
"failedLocationCount": "2"
},
"actions": [
{
"actionGroupId": "[resourceId('Microsoft.Insights/actionGroups', variables('actionGroupResourceId'))]"
}
}
]
]
}
}
]
}
Loading

0 comments on commit e14cb8e

Please sign in to comment.