本文介绍了无法在Azure上为App Insights自定义指标创建警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Azure上的App Insights自定义指标创建警报.

I'm trying to create an alert for an App Insights custom metric on Azure.

例如5分钟内,如果我的指标"指标大于40则发出警报.

e.g. alert if the "My Metric" metric is greater than 40 for 5 minutes.

根据Azure Monitor中的自定义指标,这应该是可能的.

According to Custom metrics in Azure Monitor this should be possible.

我使用App Insights Python SDK使用此代码创建了指标(请参见用法).

I created the metric with this code using the App Insights Python SDK (see Usage).

from applicationinsights import TelemetryClient
tc = TelemetryClient('<YOUR INSTRUMENTATION KEY GOES HERE>')
tc.track_metric('My Metric', 42)
tc.flush()

我可以查看我创建的自定义指标.这是Azure门户中指标"屏幕的屏幕截图中唯一的蓝色条.

I can view the custom metric I created. It's the lone blue bar in the screenshot of the Metrics screen in the Azure portal.

但是,当我单击该屏幕上的新建规则警报"按钮时,我被带到创建规则"屏幕,但显示以下错误.

However, when I click on the New rule alert button on that screen, I'm taken to the Create rule screen but it displays the following error.

AFAIK,我只使用一种资源(App Insights的"Dev"资源)和一种指标信号("My Metric"指标),如您从屏幕快照中看到的那样.

AFAIK, I'm only using one resource (the App Insights "Dev" resource) and one metric signal (the "My Metric" metric) as you can see from the screenshot.

关于我做错了什么或我缺少什么以及如何纠正它的任何想法?

Any ideas on what I've done wrong or what I'm missing and how I can correct it?

我对Azure来说还很陌生,所以我也乐于接受有关自定义指标警报的其他方式的建议.

I'm pretty new to Azure so I'm also open to suggestions on others way of alerting on a custom metric.

推荐答案

请按照以下步骤操作:

  1. 导航到azure门户->监视器->指标->添加指标.请注意,在下拉菜单"METRIC NAMESPACE"->中,在CUSTOM下选择azure.applicationinsights:
  1. 然后在指标"下拉框中,选择您的自定义指标,例如我的指标",然后单击新警报规则":
  1. 在创建规则"页面的条件"部分下,单击下面的屏幕快照中的链接,然后填写必要的信息,然后单击完成"按钮:

这篇关于无法在Azure上为App Insights自定义指标创建警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 03:03