Skip to content

Instantly share code, notes, and snippets.

@johndowns
Created February 10, 2019 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johndowns/0ab54fd0f0845325cf24e2ac8325ee37 to your computer and use it in GitHub Desktop.
Save johndowns/0ab54fd0f0845325cf24e2ac8325ee37 to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"alertEmailAddress": {
"type": "string",
"metadata": {
"description": "The email address to receive any alerts."
}
},
"applicationInsightsLocation": {
"type": "string",
"defaultValue": "westus2",
"allowedValues": [
"eastus",
"southcentralus",
"westus2",
"northeurope",
"westeurope",
"southeastasia"
],
"metadata": {
"description": "The location in which to deploy Application Insights, since it supports a subset of Azure regions."
}
}
},
"variables": {
"applicationInsightsName": "AppInsights",
"actionGroupName": "MyApplicationWarnings"
},
"resources": [
{
"name": "[variables('applicationInsightsName')]",
"type": "Microsoft.Insights/components",
"location": "[parameters('applicationInsightsLocation')]",
"apiVersion": "2014-04-01",
"kind": "other",
"properties": {
"applicationId": "[variables('applicationInsightsName')]"
}
},
{
"name": "[variables('actionGroupName')]",
"type": "Microsoft.Insights/actionGroups",
"location": "global",
"apiVersion": "2018-03-01",
"properties": {
"groupShortName": "App Service",
"enabled": true,
"emailReceivers": [
{
"name": "Account Owner",
"emailAddress": "[parameters('alertEmailAddress')]"
}
]
}
},
{
"name": "WcfExceptions",
"type": "Microsoft.Insights/scheduledQueryRules",
"location": "[parameters('applicationInsightsLocation')]",
"apiVersion": "2018-04-16",
"tags": {
"[concat('hidden-link:', resourceId('Microsoft.Insights/components', variables('applicationInsightsName')))]": "Resource"
},
"properties": {
"description": "Exceptions from the WCF Library",
"enabled": "true",
"source": {
"query": "exceptions | where type matches regex 'System.ServiceModel.*'",
"dataSourceId": "[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]",
"queryType": "ResultCount",
"authorizedResources": [
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
]
},
"schedule": {
"frequencyInMinutes": 5,
"timeWindowInMinutes": 5
},
"action": {
"severity": "3",
"aznsAction": {
"actionGroup": [
"[resourceId('Microsoft.Insights/actionGroups', variables('actionGroupName'))]"
]
},
"trigger": {
"thresholdOperator": "GreaterThan",
"threshold": 0
},
"odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction"
}
},
"dependsOn": [
"[resourceId('Microsoft.Insights/actionGroups', variables('actionGroupName'))]",
"[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment