Skip to main content
APA
Sponsored by CAST AI — Kubernetes cost optimization Better Stack — Uptime monitoring and log management
⚠️

Alert thresholds depend on the nature of your applications. Some queries may have arbitrary tolerance thresholds. Building an efficient monitoring platform takes time. 😉

Patroni Prometheus Alert Rules

1 Prometheus alerting rule for Patroni. Exported via Embedded exporter (Patroni >= 2.1.0). These rules cover critical and warning conditions — copy and paste the YAML into your Prometheus configuration.

wget https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/refs/heads/master/dist/rules/patroni/embedded-exporter-patroni.yml
critical

2.5.1. Patroni has no Leader

A leader node (neither primary nor standby) cannot be found inside the cluster {{ $labels.scope }}

  # 1m delay allows a restart without triggering an alert.
- alert: PatroniHasNoLeader
  expr: (max by (scope) (patroni_primary) < 1) and (max by (scope) (patroni_standby_leader) < 1)
  for: 1m
  labels:
    severity: critical
  annotations:
    summary: Patroni has no Leader (instance {{ $labels.instance }})
    description: "A leader node (neither primary nor standby) cannot be found inside the cluster {{ $labels.scope }}\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"