Created
January 23, 2018 12:01
-
-
Save bentaylorwork/34280633f9e5d590febe89cec07acda5 to your computer and use it in GitHub Desktop.
Adds an Azure alert to existing VMs to monitor Processor Queue Length with the threshold based on the VM core count and a multiplier.
This file contains hidden or 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": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "vmNames": { | |
| "type": "array", | |
| "defaultValue": [ | |
| "vm1", | |
| "vm2" | |
| ], | |
| "metadata": { | |
| "description": "The names of the existing VM's you wish to add the alert to. I.E [\"vm1\", \"vm2\"]" | |
| } | |
| } | |
| }, | |
| "variables": { | |
| "alerts": { | |
| "processorQueue": { | |
| "name": "\\System\\Processor Queue Length", | |
| "isEnabled": true, | |
| "description": "Example Processor Queue Alert", | |
| "operator": "GreaterThan", | |
| "threshold": 4, | |
| "windowSize": "00:05:00", | |
| "timeAggregation": "Average" | |
| } | |
| }, | |
| "vmSizes": { | |
| "Standard_E32-16s_v3": { | |
| "cores": 32 | |
| }, | |
| "Standard_E64_v3": { | |
| "cores": 64 | |
| }, | |
| "Standard_E16s_v3": { | |
| "cores": 16 | |
| }, | |
| "Standard_D13": { | |
| "cores": 8 | |
| }, | |
| "Standard_E64s_v3": { | |
| "cores": 64 | |
| }, | |
| "Standard_A4m_v2": { | |
| "cores": 4 | |
| }, | |
| "Standard_H8m": { | |
| "cores": 8 | |
| }, | |
| "Standard_A0": { | |
| "cores": 1 | |
| }, | |
| "Standard_D16_v3": { | |
| "cores": 16 | |
| }, | |
| "Standard_DS13": { | |
| "cores": 8 | |
| }, | |
| "Standard_A10": { | |
| "cores": 8 | |
| }, | |
| "Standard_F8s": { | |
| "cores": 8 | |
| }, | |
| "Standard_H16": { | |
| "cores": 16 | |
| }, | |
| "Standard_D1_v2": { | |
| "cores": 1 | |
| }, | |
| "Standard_DS3_v2": { | |
| "cores": 4 | |
| }, | |
| "Standard_E4_v3": { | |
| "cores": 4 | |
| }, | |
| "Standard_E4s_v3": { | |
| "cores": 4 | |
| }, | |
| "Standard_NC12": { | |
| "cores": 12 | |
| }, | |
| "Standard_DS12_v2_Promo": { | |
| "cores": 4 | |
| }, | |
| "Standard_DS13_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_D3_v2": { | |
| "cores": 4 | |
| }, | |
| "Standard_E8_v3": { | |
| "cores": 8 | |
| }, | |
| "Standard_H8": { | |
| "cores": 8 | |
| }, | |
| "Standard_F4s": { | |
| "cores": 4 | |
| }, | |
| "Standard_F16": { | |
| "cores": 16 | |
| }, | |
| "Standard_D2_v2": { | |
| "cores": 2 | |
| }, | |
| "Standard_DS2_v2": { | |
| "cores": 2 | |
| }, | |
| "Standard_D14_v2": { | |
| "cores": 16 | |
| }, | |
| "Standard_DS14_v2": { | |
| "cores": 16 | |
| }, | |
| "Standard_D12": { | |
| "cores": 4 | |
| }, | |
| "Standard_DS1_v2": { | |
| "cores": 1 | |
| }, | |
| "Standard_DS5_v2": { | |
| "cores": 16 | |
| }, | |
| "Standard_D4_v2_Promo": { | |
| "cores": 8 | |
| }, | |
| "Standard_F16s": { | |
| "cores": 16 | |
| }, | |
| "Standard_D2": { | |
| "cores": 2 | |
| }, | |
| "Standard_DS13_v2_Promo": { | |
| "cores": 8 | |
| }, | |
| "Standard_D32s_v3": { | |
| "cores": 32 | |
| }, | |
| "Standard_A6": { | |
| "cores": 4 | |
| }, | |
| "Basic_A0": { | |
| "cores": 1 | |
| }, | |
| "Standard_NC24r": { | |
| "cores": 24 | |
| }, | |
| "Standard_D12_v2": { | |
| "cores": 4 | |
| }, | |
| "Standard_D3_v2_Promo": { | |
| "cores": 4 | |
| }, | |
| "Standard_DS14": { | |
| "cores": 16 | |
| }, | |
| "Standard_E32_v3": { | |
| "cores": 32 | |
| }, | |
| "Standard_D32_v3": { | |
| "cores": 32 | |
| }, | |
| "Standard_A4": { | |
| "cores": 8 | |
| }, | |
| "Standard_D8s_v3": { | |
| "cores": 8 | |
| }, | |
| "Standard_D11_v2": { | |
| "cores": 2 | |
| }, | |
| "Standard_NV12": { | |
| "cores": 12 | |
| }, | |
| "Standard_E2s_v3": { | |
| "cores": 2 | |
| }, | |
| "Standard_DS2": { | |
| "cores": 2 | |
| }, | |
| "Standard_NC24": { | |
| "cores": 24 | |
| }, | |
| "Standard_D2_v3": { | |
| "cores": 2 | |
| }, | |
| "Standard_B1s": { | |
| "cores": 1 | |
| }, | |
| "Standard_D4s_v3": { | |
| "cores": 4 | |
| }, | |
| "Standard_D4": { | |
| "cores": 8 | |
| }, | |
| "Standard_DS15_v2": { | |
| "cores": 20 | |
| }, | |
| "Standard_A11": { | |
| "cores": 16 | |
| }, | |
| "Standard_H16r": { | |
| "cores": 16 | |
| }, | |
| "Standard_DS12_v2": { | |
| "cores": 4 | |
| }, | |
| "Standard_B2s": { | |
| "cores": 2 | |
| }, | |
| "Standard_D2_v2_Promo": { | |
| "cores": 2 | |
| }, | |
| "Standard_D4_v3": { | |
| "cores": 4 | |
| }, | |
| "Basic_A2": { | |
| "cores": 2 | |
| }, | |
| "Standard_D1": { | |
| "cores": 1 | |
| }, | |
| "Standard_F1": { | |
| "cores": 1 | |
| }, | |
| "Standard_DS13-4_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_D14": { | |
| "cores": 16 | |
| }, | |
| "Standard_E64-32s_v3": { | |
| "cores": 64 | |
| }, | |
| "Standard_DS13-2_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_D5_v2_Promo": { | |
| "cores": 16 | |
| }, | |
| "Basic_A3": { | |
| "cores": 4 | |
| }, | |
| "Standard_F2": { | |
| "cores": 2 | |
| }, | |
| "Standard_E32-8s_v3": { | |
| "cores": 32 | |
| }, | |
| "Standard_DS3_v2_Promo": { | |
| "cores": 4 | |
| }, | |
| "Standard_D8_v3": { | |
| "cores": 8 | |
| }, | |
| "Standard_A2m_v2": { | |
| "cores": 2 | |
| }, | |
| "Standard_DS11_v2": { | |
| "cores": 2 | |
| }, | |
| "Standard_A8": { | |
| "cores": 8 | |
| }, | |
| "Standard_DS4": { | |
| "cores": 8 | |
| }, | |
| "Standard_F8": { | |
| "cores": 8 | |
| }, | |
| "Standard_NV24": { | |
| "cores": 24 | |
| }, | |
| "Standard_DS14-8_v2": { | |
| "cores": 16 | |
| }, | |
| "Standard_A7": { | |
| "cores": 8 | |
| }, | |
| "Standard_D64_v3": { | |
| "cores": 64 | |
| }, | |
| "Standard_DS5_v2_Promo": { | |
| "cores": 16 | |
| }, | |
| "Standard_DS12": { | |
| "cores": 4 | |
| }, | |
| "Standard_E16_v3": { | |
| "cores": 16 | |
| }, | |
| "Standard_E32s_v3": { | |
| "cores": 32 | |
| }, | |
| "Standard_A2": { | |
| "cores": 2 | |
| }, | |
| "Standard_F4": { | |
| "cores": 4 | |
| }, | |
| "Standard_D12_v2_Promo": { | |
| "cores": 4 | |
| }, | |
| "Standard_A1": { | |
| "cores": 1 | |
| }, | |
| "Standard_B2ms": { | |
| "cores": 2 | |
| }, | |
| "Standard_D11": { | |
| "cores": 2 | |
| }, | |
| "Standard_E64-16s_v3": { | |
| "cores": 64 | |
| }, | |
| "Standard_DS4_v2_Promo": { | |
| "cores": 8 | |
| }, | |
| "Standard_D2s_v3": { | |
| "cores": 2 | |
| }, | |
| "Standard_F2s": { | |
| "cores": 2 | |
| }, | |
| "Standard_DS2_v2_Promo": { | |
| "cores": 2 | |
| }, | |
| "Standard_DS14-4_v2": { | |
| "cores": 16 | |
| }, | |
| "Standard_B1ms": { | |
| "cores": 1 | |
| }, | |
| "Standard_DS4_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_D14_v2_Promo": { | |
| "cores": 16 | |
| }, | |
| "Standard_NC6": { | |
| "cores": 6 | |
| }, | |
| "Standard_DS11_v2_Promo": { | |
| "cores": 2 | |
| }, | |
| "Standard_D11_v2_Promo": { | |
| "cores": 2 | |
| }, | |
| "Standard_B4ms": { | |
| "cores": 4 | |
| }, | |
| "Basic_A4": { | |
| "cores": 8 | |
| }, | |
| "Standard_H16m": { | |
| "cores": 16 | |
| }, | |
| "Standard_E2_v3": { | |
| "cores": 2 | |
| }, | |
| "Standard_D5_v2": { | |
| "cores": 16 | |
| }, | |
| "Standard_A3": { | |
| "cores": 4 | |
| }, | |
| "Standard_A5": { | |
| "cores": 2 | |
| }, | |
| "Standard_D13_v2_Promo": { | |
| "cores": 8 | |
| }, | |
| "Standard_D3": { | |
| "cores": 4 | |
| }, | |
| "Standard_A2_v2": { | |
| "cores": 2 | |
| }, | |
| "Standard_A1_v2": { | |
| "cores": 1 | |
| }, | |
| "Standard_D64s_v3": { | |
| "cores": 64 | |
| }, | |
| "Standard_A9": { | |
| "cores": 16 | |
| }, | |
| "Basic_A1": { | |
| "cores": 1 | |
| }, | |
| "Standard_DS1": { | |
| "cores": 1 | |
| }, | |
| "Standard_D15_v2": { | |
| "cores": 20 | |
| }, | |
| "Standard_DS11": { | |
| "cores": 2 | |
| }, | |
| "Standard_E8s_v3": { | |
| "cores": 8 | |
| }, | |
| "Standard_A8m_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_B8ms": { | |
| "cores": 8 | |
| }, | |
| "Standard_F1s": { | |
| "cores": 1 | |
| }, | |
| "Standard_DS3": { | |
| "cores": 4 | |
| }, | |
| "Standard_NV6": { | |
| "cores": 6 | |
| }, | |
| "Standard_D16s_v3": { | |
| "cores": 16 | |
| }, | |
| "Standard_A8_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_A4_v2": { | |
| "cores": 4 | |
| }, | |
| "Standard_H16mr": { | |
| "cores": 16 | |
| }, | |
| "Standard_D13_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_D4_v2": { | |
| "cores": 8 | |
| }, | |
| "Standard_DS14_v2_Promo": { | |
| "cores": 16 | |
| } | |
| } | |
| }, | |
| "resources": [ | |
| { | |
| "type": "Microsoft.Insights/alertRules", | |
| "copy": { | |
| "name": "alertCopy", | |
| "count": "[length(parameters('vmNames'))]" | |
| }, | |
| "name": "[concat('alert-cpu-queue-', parameters('vmNames')[copyIndex()])]", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2016-03-01", | |
| "properties": { | |
| "name": "[concat('alert-cpu-queue-', parameters('vmNames')[copyIndex()])]", | |
| "description": "[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmNames')[copyIndex()]), '2017-03-30').hardwareProfile.vmSize]", | |
| "isEnabled": "[variables('alerts').processorQueue.isEnabled]", | |
| "condition": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", | |
| "dataSource": { | |
| "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", | |
| "resourceUri": "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmNames')[copyIndex()])]", | |
| "metricName": "[variables('alerts').processorQueue.name]" | |
| }, | |
| "operator": "[variables('alerts').processorQueue.operator]", | |
| "threshold": "[mul(variables('vmSizes')[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmNames')[copyIndex()]), '2017-03-30').hardwareProfile.vmSize].cores, variables('alerts').processorQueue.threshold)]", | |
| "windowSize": "[variables('alerts').processorQueue.windowSize]", | |
| "timeAggregation": "[variables('alerts').processorQueue.timeAggregation]" | |
| }, | |
| "actions": [] | |
| } | |
| } | |
| ], | |
| "outputs": {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment