
Prometheus evaluates alert expressions and generates alert instances, but it does not deliver notifications (email, SMS, Slack). That responsibility belongs to Alertmanager, which receives alerts from Prometheus and handles deduplication, grouping, silencing, and routing to external channels.

Alert rules and rule files
Alert rules are defined in the same rule format as recording rules. The main difference is the presence of thealert key for alerting rules, while recording rules use record. Both rule types can live in the same rule group.
Example rule group containing a recording rule and an alert:
node_memory_memFree_percentis a recording rule used to precompute a metric.LowMemoryis an alert that fires whennode_memory_memFree_percent < 20has held true for 3 minutes.
up metric returns 0 for unreachable targets:
for clause delays the alert transition to firing until the expression has been true for the given duration. This prevents alerts from firing on transient scrape failures or brief network blips.
Use
for to avoid false positives for sustained conditions (e.g., sustained high CPU). For extremely urgent conditions (e.g., data corruption, loss of control plane) keep for short or omit it to allow faster notifications.Example alerts file
Prometheus reads rule files (commonly placed under/etc/prometheus/rules.yml or a rules directory). Example snippet:
Alert lifecycle and states
Prometheus alerts go through three states:Quick reference: alert rule fields
Putting it together: Prometheus + Alertmanager
- Prometheus evaluates alerting rules and creates alert instances when expressions match timeseries.
- Prometheus sends alerts to one or more Alertmanager instances.
- Alertmanager handles deduplication, grouping, silencing, and routing notifications to integrations such as email, Slack, PagerDuty, or webhooks.
- A single Alertmanager can receive alerts from multiple Prometheus servers across environments.