Azure monitoring: MetricsAlert vs AlertRules, can't see AlertRules in Monitor

时间:2019-06-01 14:14:39

标签: azure azure-resource-manager azure-monitoring

I have an ARM template with these two monitoring types:

  1. Microsoft.Insights/alertrules
  2. microsoft.insights/metricAlerts

The Microsoft.Insights/alertrules looks like this:

{
  "apiVersion": "2014-04-01",
  "name": "[concat('CPUHigh ', parameters('hostingPlanName'))]",
  "type": "Microsoft.Insights/alertrules",
  "location": "[resourceGroup().location]",
  "dependsOn": [
    "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
  ],
  "tags": {
    "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
    "displayName": "CPUHighAlertRule"
  },
  "properties": {
    "name": "[concat('CPUHigh ', parameters('hostingPlanName'))]",
    "description": "[concat('The average CPU is high across all the instances of ', parameters('hostingPlanName'))]",
    "isEnabled": true,
    "condition": {
      "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
      "dataSource": {
        "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
        "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
        "metricName": "CpuPercentage"
      },
      "operator": "GreaterThan",
      "threshold": 90,
      "windowSize": "PT15M"
    },
    "action": {
      "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
      "sendToServiceOwners": true,
      "customEmails": []
    }
  }
}

And the microsoft.insights/metricAlerts looks like this

   {
      "type": "microsoft.insights/metricAlerts",
      "apiVersion": "2018-03-01",
      "name": "CreatedThisFromARM",
      "location": "global",
      "properties": {
        "description": "Created this from ARM. Does it show up or not?",
        "severity": 3,
        "enabled": true,
        "scopes": [
          "/subscriptions/4ec6f523-de5f-4e8a-a6e7-45e4f53170df/resourceGroups/AzureResourceGroup4/providers/Microsoft.Web/serverFarms/plantestmonitor"
        ],
        "evaluationFrequency": "PT1M",
        "windowSize": "PT5M",
        "criteria": {
          "allOf": [
            {
              "criterionType": "StaticThresholdCriterion",
              "name": "MemoryFromARM",
              "metricName": "MemoryPercentage",
              "dimensions": [],
              "operator": "GreaterThan",
              "threshold": 90,
              "timeAggregation": "Average"
            }
          ],
          "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
        },
        "actions": []
      }
    }

When I enter my monitor tab I can see microsoft.insights/metricAlerts but not the Microsoft.Insights/alertrules. I would expect to see both. If I go to the Insights (preview) tab under the Monitoring menu of the resource group, I can see both.

I am wrong in my opinion that i should see both types under the Monitor --> Alerts? Or?

Maybe I am not understanding the difference between the two clearly enough (and my google foo hasn't been able to bring me to some doc that describe it for me). Maybe I am misunderstanding the two concepts?

1 个答案:

答案 0 :(得分:0)

过一会儿,alertRule出现在经典警报部分中,当在监视器中输入“警报”时会参考该规则。因此,我可以从监视器中看到两者。您只需要稍等片刻即可。

正如我所见,“ Alerts(Classic)将于8月31日停用。使用自愿迁移工具升级到更快,更简单,更具可伸缩性的指标警报平台”,因此经典警报必须是Microsoft.Insights / alertrules。因此,metricAlerts是Azure监视的未来。如果我错了,请纠正我。