1. The alerting chain #
From rules to contact points.
Overview #
The alerting service evaluates rules against your sources (every 5 s by default, ALERTING_TICK_SECONDS), moves alerts from pending to firing, then applies routing, silences, inhibitions and time intervals before sending to contact points. In high availability, only the elected leader evaluates.
Writing a rule #
groups:
- name: checkout
rules:
- alert: CheckoutHighErrorRate
expr: |
sum(rate(http_server_request_duration_seconds_count{service_name="checkout", http_response_status_code=~"5.."}[5m]))
/ sum(rate(http_server_request_duration_seconds_count{service_name="checkout"}[5m])) > 0.05
for: 5m
keep_firing_for: 10m
labels:
severity: critical
service_name: checkout
annotations:
summary: "More than 5% errors on checkout"The format is that of Prometheus rule groups (alert, expr, for, keep_firing_for, labels, annotations), importable and exportable as YAML. The x-observa extension allows a threshold on any source, not just PromQL.
Routing notifications #
route:
receiver: ops
group_by: [alertname, service_name, deployment_environment_name]
routes:
- matchers: ['severity="critical"', 'sla_tier=~"gold|platinum"']
receiver: itsm
receivers:
- name: ops
msteams_configs: [{ webhook_url: https://…, send_resolved: true }]
- name: itsm
servicenow_configs:
- instance_url: https://acme.service-now.com
mode: incident
username: observa
password: <secret>
assignment_group: Run-Ops
pagerduty_configs: [{ routing_key: <secret> }]Contact points: ServiceNow, Jira, PagerDuty, Opsgenie, Splunk On-Call, Microsoft Teams, Slack, Google Chat, Discord, Webex, Telegram, SMTP e-mail, webhook (“Alertmanager webhook v4” payload) and external Alertmanager. Silences, mute timings, notification templates, state history and the notification log complete the set.
Best practice : Group byalertnameandservice_name: a database outage hitting 30 pods should produce one notification, not 30.
Centralizing Prometheus alerts #
# prometheus.yml: Prometheus sends its alerts to Observa (Alertmanager v2 API)
alerting:
alertmanagers:
- scheme: https
path_prefix: /api/alertmanager
authorization:
credentials: <ALERT_INGEST_TOKEN>
static_configs:
- targets: ["observa.example.com"]Observa exposes the Alertmanager v2 API under /api/alertmanager (/api/v2/alerts, /silences, /alerts/groups, /status). Prometheus, vmalert or the Loki ruler send their alerts there, protected by the ALERT_INGEST_TOKEN; they then follow the same routing.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Prometheus: alerting with Alertmanager (rules, routing, silences)
Set up Prometheus alerting: alert rules, Alertmanager, routing, grouping, inhibition, silences, S...
Alerting best practices: Prometheus, Alertmanager and on-call
Checklist for effective alerting: symptom-based rules, severities, routing by team, noise reducti...
Grafana Alerting and on-call management
Create alerts in Grafana (rules, contact points, notification policies), provision them in YAML, ...
Alerts, notifications and anomaly detection in OpenSearch
Monitoring your data with OpenSearch: monitor types, triggers, actions and throttling, Slack, web...
Writing good Prometheus alerting rules (and testing them)
Design useful alerts: alert on symptoms, choose for and thresholds, severity and team labels, ann...
Observa best practices
Best practices to run Observa in production: deployment, security, sources, dashboards, alerting,...
Alerting on logs with the Loki Ruler
Set up LogQL alerts and recording rules with the Loki Ruler: configuration, rule files, Alertmana...
SLOs, on-call and incidents in Observa
Define SLOs in Observa (error budget, burn rate, multi-window alerts), organize on-call and escal...
Alertmanager high availability and operations
Set up a highly available Alertmanager cluster (gossip), configure Prometheus for all members, mo...