Guest User

PromRules

a guest
Dec 19th, 2024
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.11 KB | None | 0 0
  1. apiVersion: monitoring.coreos.com/v1
  2. kind: PrometheusRule
  3. metadata:
  4.   labels:
  5.     release: monitoring
  6.   name: daniel-custom-rules-prod
  7.   namespace: monitoring
  8. spec:
  9.   groups:
  10.     - name: "pod-error-rule"
  11.       rules:
  12.         - alert: PodErrorAlert
  13.           for: 3m
  14.           expr: count(kube_pod_container_status_terminated_reason{reason='Error'} > 0) by (namespace, pod)
  15.           labels:
  16.             severity: critical
  17.           annotations:
  18.             summary: Pod has been in error state for more than 10 minutes.
  19.             message: "pod {{ $labels.pod }} in the {{ $labels.namespace }} namespace has been in error state for more than 10m"
  20.     - name: "pod-pending-rule"
  21.       rules:
  22.         - alert: PodPendingFor30mAlert
  23.           for: 2m
  24.           expr: count(kube_pod_status_phase{phase="Pending"} > 0) by (namespace, pod)
  25.           labels:
  26.             severity: critical
  27.           annotations:
  28.             summary: Pod has been pending for more than 30 minutes.
  29.             message: "pod {{ $labels.pod }} in the {{ $labels.namespace }} namespace has been in pending state for more than 30m"
  30.  
Add Comment
Please, Sign In to add comment