英文:
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文档的指引进行操作:
在创建警报规则时:
选择自定义日志搜索,然后输入查询:
AzureActivity | where false
然后在下一个部分将“等于”设置为0:
问题可能出现在创建警报的操作部分。
输出:
我按照Microsoft文档的步骤创建了警报,请尝试按照该流程操作,您肯定会收到警报。
或者,您可以使用 Query | Count
。
英文:
I have reproduced in my environment and got expected results as below and I followed Microsoft-Document:
While creating alert rule:
After selecting Custom log search then type the query:
AzureActivity | where false
And then in next section equal to and then threshold to 0:
The problem might be in your actions section of creating alert.
Output:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论