0
resource "azurerm_monitor_metric_alert" "exception_alert_test_incoming_orders" {
  name                = "IncomingOrderTest"
  resource_group_name = "${var.azurerm_resource_group_name}"
  scopes              = ["${azurerm_application_insights.app_insights_test.id}"]

  enabled = "${var.test_insight_alerts_enabled}"

  description = "Alert due to 0 incoming orders on last 24 hours (Test)"

  frequency = "PT1H"

  window_size = "P1D"

  criteria {
    metric_namespace = "Azure.ApplicationInsights"
    metric_name      = "IncomingOrder"
    aggregation      = "Count"
    operator         = "Equals"
    threshold        = 0

  }

  action {
    action_group_id = "${azurerm_monitor_action_group.monitor_alert_action_test.id}"
  }
}

警报没有触发变量是正确的,并且不确定 metric_namespace。

4

2 回答 2

0

您似乎需要使用monitor_scheduled_query_rules_alert来监控自定义指标并发出警报。

于 2020-10-06T23:17:38.880 回答
0

metric_namespace需要表示 azure 资源类型。

例如:"Microsoft.Storage/storageAccounts"因为这是生成警报指标的地方。

我相信对于应用程序洞察力metric_namespace来说是microsoft.insights/components.

其他一切看起来都不错!

于 2020-02-07T04:13:50.217 回答