Prometheus和Openshift
- prometheus.yml配置中綁定alertmanager服務(wù)
......
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "localhost:9093"
- prometheus.rules設(shè)置prometheus告警規(guī)則
...
rules:
- alert: TooManyPods
expr: kuberlet_running_pod_count > 10
for: 2m
labels:
team: node
annotations:
summary: "{{$labels.instance}}: has {{$value}} pods"
description: "{{$labels.instance}} be cateful"
規(guī)則:kuberlet_running_pod_count
指標(biāo)持續(xù)2分鐘超過10,則發(fā)出告警敌买。
- AlertManager中設(shè)置告警接收器alertmanager.yml
global:
smtp_smarthost: 'mail.xx.com:25'
smtp_from: 'service@xx.com'
smtp_auth_username: 'service@xx.com'
smtp_auth_password: 'password'
smtp_require_tls: false
route:
group_by: ['alertname']
receiver: alert-email
receivers:
- name: alert-email
email_configs:
- to: 'pan@xx.com'
send_resolved: true