0
votes

I have created a set of Availability tests in Application Insights, and want to add Alerts to notify the team about unexpected failures, but I haven't managed to do it. Alerts don't change its state after creation and it looks like, they are not able to get Metric data at all.

When I open Availability test resource (from Application Insights blade or Resource Group) - I see a huge graph with a lot of green/red dots on it, showing executed tests during last 1/24/72 hours:

Availability test results

When I try to create a Metric Alert, I choose the same Availability Test resource and Uptime metric for it but proposed graph display nothing (note the strict horizontal line and 1970th year), while any tutorial shows examples with nice graphs in it

Metric Alert editing

Any created alert doesn't react on changed resource availability too.

Here is a part of my ARM template:

    {
  "apiVersion": "2016-03-01",
  "name": "[variables('alerts').vehiclesHealth]",
  "type": "microsoft.insights/alertrules",
  "location": "[resourceGroup().location]",
  "tags": {
    "[concat('hidden-link:', resourceId('Microsoft.Insights/components', variables('appInsights').name))]": "Resource",
    "displayName": "app-insights-alert",
    "env": "[parameters('environment')]"
  },
  "properties": {
    "name": "[variables('alerts').vehiclesHealth]",
    "condition": {
      "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
      "dataSource": {
        "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
        "resourceUri": "[resourceId('microsoft.insights/webtests', variables('tests').vehiclesHealth)]",
        "metricName": "locations/emea-nl-ams-azr/metrics/GSMT_AvRaw"
      },
      "operator": "LessThan",
      "threshold": 50,
      "windowSize": "PT1H"
    },
    "actions": "[variables('alerts').actions]"
  },
  "dependsOn": [
    "[resourceId('microsoft.insights/webtests', variables('tests').vehiclesHealth)]"
  ]
},

I suppose that I may use a wrong metric name or resource reference, but I have no idea how to check it. Is there any Powershell script or REST API to get all available metrics for a particular resource?

My main question is: what am I doing wrong and how to get it working?

1
Team is looking into this...ZakiMa

1 Answers

0
votes

You are asking two separate questions:

a) Why is a preview of your availability metric not showing while you are configuring the alert?

b) How to debug an alert created via a script.

Let me respond to them in turns:

A) This is a known bug. There is a team working on improving that experience, however I cannot share a target date at this time. Luckily, this bug relates to the preview only and it should not affect the correct function of the alert.

B) I recommend that you create an alert using the UI and then download the ARM template and compare it to your draft. That would be a good starting point for making sure that all names are correct.