我的警报配置如下。
ALERT PoDHighCPUUsage
IF sum(rate(container_cpu_usage_seconds_total{container_label_io_kubernetes_pod_namespace!=""}[2m])) BY (kubernetes_pod_name, kubernetes_io_hostname, container_label_io_kubernetes_pod_namespace) >= 0.2
FOR 2m
LABELS {severity="criticalup"}
ANNOTATIONS {summary="CPU usage of POD {{ $labels.kubernetes_pod_name }} {{ $labels.container_label_io_kubernetes_pod_namespace }} utilization is >= 0.4 cores (current value: {{ $value }}%)"}
我的webhooks如下..
- name: 'email-n-webhookup'
email_configs:
- to: 'mail-id'
send_resolved: true
webhook_configs:
- url: http://<webhook_ip>:9000/hooks/ose-webhook?in1={{.Labels.container_label_io_kubernetes_pod_namespace}}&in2={{.Labels.kubernetes_pod_name}}&in3=plus
- name: 'email-n-webhookdn'
email_configs:
- to: 'mail-id'
send_resolved: true
webhook_configs:
- url: http://<webhook_ip>:9000/hooks/ose-webhook?in1=tomi&in2=chat&in3=minus
我无法传递值/数据&#34; labels.kubernetes_pod_name&#34; &安培; &#34; labels.container_label_io_kubernetes_pod_namespace&#34;在webhook_configs。
静态地按照&#34; email-n-webhookdn&#34;
工作答案 0 :(得分:2)
并非所有字段都是模板化的,webhook网址就是其中之一。它预计接收webhook的代码会查看它在POST中收到的json,以获取所有警报及其标签。