Grafana Alerting Grundlagen
Grafana Alerting Stack:
1. Alert Rule → PromQL-Abfrage mit Schwellwert
2. Contact Point → Wohin Benachrichtigung (Email/Slack/...)
3. Notification Policy → Wann welcher Contact Point
4. Silences → Wartungsfenster ohne Alerts
Contact Points einrichten
Grafana → Alerting → Contact Points → New
E-Mail:
Type: Email
Addresses: [email protected]
SMTP: Settings → SMTP (muss konfiguriert sein)
Slack:
Type: Slack
Webhook URL: https://hooks.slack.com/services/...
Channel: #alerts-production
Telegram:
Type: Telegram
Bot Token: [von @BotFather]
Chat ID: -100XXXXXXXXX
PagerDuty:
Type: PagerDuty
Integration Key: [aus PagerDuty]
Grafana SMTP konfigurieren
# grafana.ini oder docker-compose environment
[smtp]
enabled = true
host = mail.firma.de:587
user = [email protected]
password = passwort
from_address = [email protected]
from_name = Grafana Alerts
skip_verify = false
# docker-compose.yml environment:
GF_SMTP_ENABLED: "true"
GF_SMTP_HOST: "mail.firma.de:587"
GF_SMTP_USER: "[email protected]"
GF_SMTP_PASSWORD: "passwort"
GF_SMTP_FROM_ADDRESS: "[email protected]"
Alert Rules erstellen
Grafana → Alerting → Alert Rules → New Alert Rule
Name: CPU über 90% für 5 Minuten
Query A (PromQL):
100 - (avg by(instance)(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
Condition:
When: A is above 90
For: 5m
Labels:
severity: critical
team: ops
Folder: Production
Annotations:
Summary: Hohe CPU-Auslastung
Description: CPU auf {{ $labels.instance }}: {{ $values.A.Value | humanize }}%
Notification Policies
Alerting → Notification Policies:
Root Policy:
Contact Point: E-Mail (Default)
Override Policy 1:
Label: severity = critical
Contact Point: PagerDuty + Slack
Group wait: 30s
Group interval: 5m
Repeat interval: 1h
Override Policy 2:
Label: team = database
Contact Point: DBA-Team-Slack
Silences (Wartungsfenster)
Alerting → Silences → New Silence
Start: 2025-06-15 22:00
End: 2025-06-16 02:00
Labels:
instance = prod-db-01
→ Kein Alert für prod-db-01 während Wartung!
Alert-Dashboard erstellen
Dashboards → New → Alert List Panel:
- Zeigt alle aktuell aktiven Alerts
- Filtern nach Label/Severity
- Link zum Detail-Dashboard
FAQ
Unterschied Grafana Alerting vs. Prometheus Alertmanager?
Für Prometheus-Daten besser: Alertmanager (mächtigere Routing-Logik). Grafana Alerting: einfacher, unterstützt alle Grafana-Datasources (nicht nur Prometheus).
Fazit
Grafana Alerting bietet einfache Alert-Konfiguration direkt im Dashboard-Tool ohne zusätzlichen Alertmanager – ideal für Teams die bereits Grafana nutzen.
Grafana Alerting für KMU in Heidelberg, Mannheim und der Rhein-Neckar-Region. Anfragen.