How to configure Prometheus alerts?
· Category: DevOps & CI/CD
Short answer
Prometheus alerts are defined by recording and alerting rules. Alertmanager handles routing, grouping, and notification.
Steps
- Create alerting rules.
- Load them into Prometheus.
- Configure Alertmanager for routing.
- Set up notification channels.
Example
groups:
- name: example
rules:
- alert: HighMemoryUsage
expr: (node_memory_Active_bytes / node_memory_MemTotal_bytes) > 0.8
for: 5m
labels:
severity: warning
annotations:
summary: "High memory usage"
Tips
- Use
forto prevent flapping. - Group related alerts.
- Route by severity.
Common issues
- Alert fatigue from noisy rules.
- Missing
forcauses false positives. - Alertmanager silences require maintenance.