origin icon indicating copy to clipboard operation
origin copied to clipboard

Customize Prometheus Alerts in OKD 4.11

Open gfsmarting opened this issue 2 years ago • 0 comments

We are using prometheus included in okd to gather metrics of our cluster:

  • OKD version release: 4.11.0-0.okd-2022-08-20-022919
  • UPI install on baremetal

Actually we created a new metric along their alert rule for storage use with this yaml

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: storagealertprodcritical
  managedFields:
  labels:
    role: storagealertprodcritical
spec:
  groups:
    - name: default-storage-classes.rules
      rules:
        - alert: CustomPersistentVolumeFillingUpCritical
          annotations:
            description: >
              "Storage Alert. [Critical]"
            message: >-
              "Space used more than %90"
            summary: Make free space
          expr: '(kubelet_volume_stats_available_bytes{job="kubelet",metrics_path="/metrics",namespace=~"(.*-pro)"} / kubelet_volume_stats_capacity_bytes{job="kubelet",metrics_path="/metrics",namespace=~"(.*-pro)"}) < 0.10'
          for: 10m
          labels:
            severity: critical

This alerts are sent by email and works just fine.

From the above we want 2 things:

  1. Be able to customize the subject and the body of the alert sent to the email.
  2. Be capable to send them by Telegram.

gfsmarting avatar Nov 29 '23 17:11 gfsmarting