azureazure-sql-databaseazure-application-insightsazure-monitoringsql-azure-alerts

Azure ARM template schema/documentation for setting up alerts on Database Pools


I can’t find the documentation for the name of events/metrics that can be defined through ARM template to set up alerts on a SQL Elastic Database Pool. For example, I am guessing "EdtuPercentage" is the logical name for that metric but would like to know where to look it up. I can’t find alerts created on the portal on the ARM Explorer either. I appreciate any help!

{
  "name": "[concat(variables('createElasticPoolOperationName'), '-0')]",
  "type": "Microsoft.Resources/deployments",
  "apiVersion": "2015-01-01",
  "dependsOn": [ "[concat('Microsoft.Resources/deployments/', variables('createSqlServerOperationName'))]" ],
  "properties": {
    "mode": "Incremental",
    "templateLink": {
      "uri": "[variables('templateUrls').CreateSqlElasticPoolTemplateUrl]",
      "contentVersion": "1.0.0.0"
    },
    "parameters": {
      "sqlServerName": {
        "value": "[variables('sqlServerName')]"
      },
      "name": {
        "value": "[concat(variables('elasticPoolCanonicalName'), '-0')]"
      },
      "edition": {
        "value": "[parameters('elasticPoolSettings').edition]"
      },
      "dtu": {
        "value": "[parameters('elasticPoolSettings').dtu]"
      },
      "databaseDtuMin": {
        "value": "[parameters('elasticPoolSettings').databaseDtuMin]"
      },
      "databaseDtuMax": {
        "value": "[parameters('elasticPoolSettings').databaseDtuMax]"
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Insights/alertRules",
      "name": "[parameters('alertSettings').name]",
      "location": "[resourceGroup().location]",
      "apiVersion": "2014-04-01",
      "properties": {
        "name": "[parameters('alertSettings').name]",
        "description": "[parameters('alertSettings').description]",
        "isEnabled": true,
        "condition": {
          "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
              "dataSource": {
                "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
                "resourceUri": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/Default-Storage-NorthCentralUS/providers/Microsoft.Web/serverfarms/Plan",
                "metricName": "EdtuPercentage"
              },
          "threshold": 1,
          "windowSize": "PT15M",
          "timeAggregation": "Average"
        },
        "action": {
          "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
          "sendToServiceOwners": "[parameters('alertSettings').sendToServiceOwners]"
        }
      }
    }

  ]
}

Solution

  • To find a list of all the applicable/available metrics that can be set on a particular resource, there is a powerShell Command. You can use this powershell command to get a list of all such metrics with their logical names.

    Get-AzureRmMetricDefinition

    For example, if you want to lookup for a list of metrics for alerts for your elastic pool, you can simple use this command,

    Get-AzureRmMetricDefinition -ResourceId "ElasticPoolResourceId"

    You can provide the resourceID of your elastic Pool as a paramter here. And it will give you a list of all the applicable metrics for setting up alerts.

    Hope this helps!