Azure Application Insights AKS - 如何创建 1 个自定义警报规则来触发多个警报,但名称不同(每个 Pod 名称)?

问题描述 投票:0回答:1

有没有办法为 CrashLoopBackOff 创建 1 个自定义警报规则(作为示例) 这将触发多个警报。所有警报都相同,但 Pod 名称不同。

在 Prometheus 中,我们收到每个 pod 的警报,但我不确定是否可以在 Azure Application Insights 中实现。

azure azure-devops azure-application-insights azure-aks azure-monitoring
1个回答
0
投票

您可以使用“警报规则”进行存档。 Insight 本身没有警报功能。
方法一:自定义日志搜索
步骤:

  1. 转到 AKS 中的“警报”,然后“创建”->“警报规则”
  2. 将信号名称设置为“自定义日志搜索”
  3. 根据以下内容修改查询:
KubePodInventory
| where ContainerStatus  == 'waiting' 
| extend ContainerLastStatus=todynamic(ContainerLastStatus)
| summarize RestartCount = arg_max(ContainerRestartCount, Computer, Namespace, ContainerStatusReason) by Name
  1. 运行一次,然后“继续编辑警报”
  2. 选择“聚合粒度”
  3. 将警报逻辑设置为“大于0”
  4. 设置“按维度分割”,将“ContainerStatusReason”设置为您想要的任何值
    Image: set “Split by dimensions”
  5. 接下来做你想做的事。完整文档:https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-create-log-alert-rule

输出示例:
Image: example alert output

方法二:使用预定义的Prometheus警报规则
Image: use built-in alert rules based on Prometheus

© www.soinside.com 2019 - 2024. All rights reserved.