-
-
Save johndowns/b6798ebc45311c6c1e6ff854c0af51c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$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." | |
} | |
}, | |
"cosmosDbAccountName": { | |
"type": "string", | |
"defaultValue": "[uniqueString(subscription().subscriptionId, resourceGroup().name)]", | |
"metadata": { | |
"description": "The name to use when creating the Cosmos DB account. This must be globally unique." | |
} | |
} | |
}, | |
"variables": { | |
"actionGroupName": "MyApplicationErrors" | |
}, | |
"resources": [ | |
{ | |
"name": "[parameters('cosmosDbAccountName')]", | |
"type": "Microsoft.DocumentDB/databaseAccounts", | |
"location": "[resourceGroup().location]", | |
"apiVersion": "2015-04-08", | |
"kind": "GlobalDocumentDB", | |
"properties": { | |
"databaseAccountOfferType": "Standard", | |
"consistencyPolicy": { | |
"defaultConsistencyLevel": "Session", | |
"maxIntervalInSeconds": 5, | |
"maxStalenessPrefix": 100 | |
} | |
} | |
}, | |
{ | |
"name": "[variables('actionGroupName')]", | |
"type": "Microsoft.Insights/actionGroups", | |
"location": "global", | |
"apiVersion": "2018-03-01", | |
"properties": { | |
"groupShortName": "Cosmos DB", | |
"enabled": true, | |
"emailReceivers": [ | |
{ | |
"name": "Account Owner", | |
"emailAddress": "[parameters('alertEmailAddress')]" | |
} | |
] | |
} | |
}, | |
{ | |
"name": "ThrottledRequests", | |
"type": "Microsoft.Insights/metricAlerts", | |
"location": "global", | |
"apiVersion": "2018-03-01", | |
"properties": { | |
"description": "[concat('The number of throttled requests has increased beyond the specified threshold.')]", | |
"severity": 2, | |
"enabled": true, | |
"scopes": [ | |
"[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbAccountName'))]" | |
], | |
"evaluationFrequency": "PT5M", | |
"windowSize": "PT1H", | |
"criteria": { | |
"odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", | |
"allOf": [ | |
{ | |
"name": "Throttled requests greater than 1", | |
"metricName": "TotalRequests", | |
"dimensions": [ | |
{ | |
"name": "StatusCode", | |
"operator": "Include", | |
"values": [ | |
"429" | |
] | |
} | |
], | |
"operator": "GreaterThan", | |
"threshold": 1, | |
"timeAggregation": "Maximum" | |
} | |
] | |
}, | |
"actions": [ | |
{ | |
"actionGroupId": "[resourceId('Microsoft.Insights/actionGroups', variables('actionGroupName'))]" | |
} | |
], | |
"dependsOn": [ | |
"[resourceId('Microsoft.Insights/actionGroups', variables('actionGroupName'))]", | |
"[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbAccountName'))]" | |
] | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment