【发布时间】:2019-01-03 07:09:09
【问题描述】:
我在 Prometheus 中为 pod 内存使用情况创建了警报规则。警报在我的松弛频道上完美显示,但它不包含 pod 的名称,因此很难理解哪个 pod 有问题。
它只是显示[FIRING:35] (POD_MEMORY_HIGH_UTILIZATION default/k8s warning)。但是当我查看 Prometheus UI 中的“警报”部分时,我可以看到触发的规则及其 pod 名称。有人可以帮忙吗?
我的警报通知模板如下:
alertname: TargetDown
alertname: POD_CPU_HIGH_UTILIZATION
alertname: POD_MEMORY_HIGH_UTILIZATION
receivers:
- name: 'slack-notifications'
slack_configs:
- channel: '#devops'
title: '{{ .CommonAnnotations.summary }}'
text: '{{ .CommonAnnotations.description }}'
send_resolved: true
我在警报通知模板中添加了选项title: '{{ .CommonAnnotations.summary }}' text: '{{ .CommonAnnotations.description }}',现在它显示了描述。我的描述是description: pod {{$labels.pod}} is using high memory。但只显示is using high memory。未指定 pod 名称
【问题讨论】:
-
您将不得不分享从 Prometheus 到 Slack 的数据是如何共享的 - 没有它就很难回答这个问题
-
我的告警通知模板如下: ---------------------------------- --- 路由:group_by:['job'] group_wait:1s group_interval:1m repeat_interval:12h 接收器:'slack-notifications' 路由:-匹配:alertname:POD_MEMORY_HIGH_UTILIZATION 接收器:-名称:'slack-notifications' slack_configs:-通道:'#devops' 标题:'{{ .CommonAnnotations.summary }}' 文本:'{{ .CommonAnnotations.description }}' send_resolved: true ------------------ -------------------
-
我在警报通知模板中添加了选项“title: '{{ .CommonAnnotations.summary }}' text: '{{ .CommonAnnotations.description }}'”,现在它显示描述。我的描述是“描述:pod {{$labels.pod}} 正在使用高内存”。但只显示“正在使用高内存”。未指定 pod 名称。
-
标签未预先填充,您必须在警报级别进行配置。您是否还可以添加有问题的这些额外信息 - 它会帮助其他人
标签: kubernetes prometheus-alertmanager