必须定义命名空间以使用自定义指标

问题描述

我正在尝试使用Terraform部署VM的来宾指标下的“内存”指标,我已经为我正在使用的指标定义了名称空间,但是它低于错误。

创建或更新度量标准警报“内存使用警报”(资源组“ MyTemp”)时出错:Insights.MetricAlertsClient#CreateOrUpdate:对请求的响应失败:StatusCode = 400-原始错误:autorest / azure:服务返回了错误。 Status = 400 Code =“ BadRequest” Message =“找不到以下度量标准名称:Memory \%Committed bytes 正在使用。 请注意,对于自定义指标,必须指定相关指标名称空间。

resource "azurerm_monitor_metric_alert" "myalert" {
  name                      = "Memory Usage Alert"
  resource_group_name       = var.rg_name //resource name to which you want to deploy this alert
  scopes                    = [var.virtual_machine_id]
  description               = "Action will be triggered when Memory Utilzation count is greater than 85."
  target_resource_type      = "Microsoft.Compute/virtualMachines"
  target_resource_location  = "centralindia"
  frequency                 = "PT30M"
  window_size               = "P1D"
  severity                  = "2"
  enabled                   = "true"

  criteria {
    metric_namespace = "azure.vm.windows.guestmetrics"
    metric_name      = "Memory\\% Committed bytes in use"
    aggregation      = "Average"
    operator         = "GreaterThanOrEqual"
    threshold        = 85
  }

  action {
    action_group_id = var.action_name
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)