触发警报,如果记录集为空 Application Insights 警报规则查询

huangapple go评论68阅读模式
英文:

Trigger alert if recordset is empty Application Insights Alert Rule Query

问题

我正在尝试基于 Kusto 查询在 Application Insights 中创建警报规则。

如果结果集为空,我想触发警报。

如果我将警报逻辑设置为:

操作符 = 等于并且阈值值 = 0,

它不起作用。
这对我来说似乎是正确的,它不起作用,但我无法检查“空”。

也许有人有解决方案?

提前感谢。

英文:

I am trying to create an alert rule in Application Insights based on a Kusto query.

If the resultset is empty, I want to fire the alert.

If I set the alert logic to:

operater = Equal To and the Threshold Value = 0,

it does not work.
Which seems to me to be correct, that it does not work, but I cannot check on "Empty".

Maybe someone has a solution?

Thanks in advance.

答案1

得分: 1

你可以基于 Kusto 查询在 Application Insights 中创建警报规则,并在结果集为空时触发警报。为此,您可以在 Kusto 查询中使用 "count" 聚合函数来计算查询返回的行数。如果计数为零,则可以触发警报。

英文:

You can create an alert rule in Application Insights based on a Kusto query and fire the alert when the result set is empty. To do this, you can use the "count" aggregation function in your Kusto query to count the number of rows returned by the query. If the count is zero, then you can fire the alert.

your_kusto_query_here
| count

答案2

得分: 0

我已在我的环境中进行了复制,并获得了如下所示的预期结果,然后我按照Microsoft文档的指引进行操作:

在创建警报规则时:

触发警报,如果记录集为空 Application Insights 警报规则查询

选择自定义日志搜索,然后输入查询:

AzureActivity | where false

触发警报,如果记录集为空 Application Insights 警报规则查询

然后在下一个部分将“等于”设置为0:

触发警报,如果记录集为空 Application Insights 警报规则查询

问题可能出现在创建警报的操作部分。

触发警报,如果记录集为空 Application Insights 警报规则查询

输出:

触发警报,如果记录集为空 Application Insights 警报规则查询

触发警报,如果记录集为空 Application Insights 警报规则查询

触发警报,如果记录集为空 Application Insights 警报规则查询

我按照Microsoft文档的步骤创建了警报,请尝试按照该流程操作,您肯定会收到警报。

或者,您可以使用 Query | Count

英文:

I have reproduced in my environment and got expected results as below and I followed Microsoft-Document:

While creating alert rule:

触发警报,如果记录集为空 Application Insights 警报规则查询

After selecting Custom log search then type the query:

 AzureActivity | where false

触发警报,如果记录集为空 Application Insights 警报规则查询

And then in next section equal to and then threshold to 0:

触发警报,如果记录集为空 Application Insights 警报规则查询

The problem might be in your actions section of creating alert.

触发警报,如果记录集为空 Application Insights 警报规则查询

Output:

触发警报,如果记录集为空 Application Insights 警报规则查询

触发警报,如果记录集为空 Application Insights 警报规则查询

触发警报,如果记录集为空 Application Insights 警报规则查询

I followed the Microsoft document and got alert, please try to follow the process you will definitely get alert

Alternatively, you can use Query | Count

huangapple
  • 本文由 发表于 2023年3月15日 17:56:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75743084.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定