看不到我在Azure门户上创建的警报

时间:2018-08-28 14:11:06

标签: azure azure-application-insights azureportal

我正在Azure门户上的Application Insights中创建警报,但是由于某些原因,我无法看到它们。我知道警报正在运行,因为我正在按预期方式收到电子邮件。

使用管理API,我可以看到警报:

GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{scheduleQueryName}?api-version=2018-04-16

是什么原因阻止了他们出现在门户网站上?这是我的ARM模板

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "appInsightsName": {
      "type": "string"
    },
    "alertEmail": {
      "type": "string"
    },
    "utilityActionGroup": {
      "type": "string"
    },
    "scheduleQueryName": {
      "type": "string"
    },
    "monitoringUtilityAlertEnabled": {
      "type": "string"
    }
  },
  "variables": {},
  "resources": [
    {
      "apiVersion": "2014-04-01",
      "name": "[parameters('appInsightsName')]",
      "type": "Microsoft.Insights/components",
      "location": "[resourceGroup().location]",
      "properties": {
        "applicationId": "[parameters('appInsightsName')]"
      }
    },
    {
      "type": "Microsoft.Insights/actionGroups",
      "name": "[parameters('utilityActionGroup')]",
      "apiVersion": "2018-03-01",
      "location": "Global",
      "properties": {
        "groupShortName": "Utility",
        "enabled": true,
        "emailReceivers": [
          {
            "name": "AlertEmail",
            "emailAddress": "[parameters('alertEmail')]"
          }
        ]
      },
      "dependsOn": []
    },
    {      
      "type": "Microsoft.Insights/scheduledQueryRules",
      "name": "[parameters('scheduleQueryName')]",
      "apiVersion": "2018-04-16",
      "location": "[resourceGroup().location]",
      "tags": {
        "[concat('hidden-link: ', resourceId('Microsoft.Insights/components', parameters('appInsightsName')))]": "Resource"
      },
      "scale": null,
      "properties": {
        "description": "Sends an alert when the utility stops sending a trace to app insights",
        "enabled": "[parameters('monitoringUtilityAlertEnabled')]",
        "source": {
          "query": "traces\n| where message == \"Utility Service is alive\"  | where timestamp >= ago(30m) ",
          "authorizedResources": [],
          "dataSourceId": "[resourceId('microsoft.insights/components', parameters('appInsightsName'))]",
          "queryType": "ResultCount"
        },
        "schedule": {
          "frequencyInMinutes": 5,
          "timeWindowInMinutes": 5
        },
        "action": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
          "severity": "2",
          "aznsAction": {
            "actionGroup": [ "[resourceId('microsoft.insights/actionGroups', parameters('utilityActionGroup'))]" ],
            "emailSubject": "Monitoring Utility Stopped working"
          },
          "trigger": {
            "thresholdOperator": "Equal",
            "threshold": 0
          }
        }
      },
      "dependsOn": [
        "[resourceId('microsoft.insights/components', parameters('appInsightsName'))]",
        "[resourceId('microsoft.insights/actionGroups', parameters('utilityActionGroup'))]"
      ]
    }
  ],
  "outputs": {  }
}

1 个答案:

答案 0 :(得分:0)

根据我的测试,我通过azure门户在应用程序见解内部创建了警报,该警报可以显示在门户中。

在门户中检查警报时,请确保选择正确的资源作为您创建警报的资源。 enter image description here