[英]Azure Monitor alert on a custom metric filtered by cloud_RoleInstance
I'm able to create an alert based on my custom metric.我可以根据我的自定义指标创建警报。 However, i'd like to have several different alerts, for each cloud_RoleInstance I have.但是,对于我拥有的每个 cloud_RoleInstance,我想有几个不同的警报。 Is it possible somehow?有可能吗?
If the logs are stored in Azure Log Analytics or Azure Application Insights, then you can use Custom Log Search alert (in step 5 of this article).如果日志存储在 Azure Log Analytics 或 Azure Application Insights 中,则可以使用自定义日志搜索警报(在本文的步骤 5 中)。 Note you need to create one alert as per one cloud_RoleInstance in the query.请注意,您需要根据查询中的一个 cloud_RoleInstance 创建一个警报。
Steps as blow:打击步骤:
Step 1:步骤1:
In azure portal -> Nav to azure monitor -> Alerts -> New alert rule, then in the resource, select the Azure Log Analytics or Azure Application Insights. In azure portal -> Nav to azure monitor -> Alerts -> New alert rule, then in the resource, select the Azure Log Analytics or Azure Application Insights.
Step 2:第2步:
Then in Condition, select Add, then select "Custom log search":然后在条件中,select 添加,然后 select “自定义日志搜索”:
Step 3:第 3 步:
Then in new window, write you query to trigger the alert, remember use where clause to filter the cloud_RoleInstance.然后在新的 window 中,编写查询以触发警报,记住使用 where 子句过滤 cloud_RoleInstance。
And note that: change "Based on" from "Number of results" to "Metric measurement", and use this query:请注意:将“基于”从“结果数”更改为“公制测量”,并使用此查询:
customMetrics
| where name == 'MyMetricName'
| where cloud_RoleInstance == 'MyInstanceName'
| summarize AggregatedValue = sum(value) by bin(timestamp, 5m)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.