PostgreSQL HA Lite (Patroni + postgres_exporter)

Compact PostgreSQL high-availability dashboard: Patroni leader and replicas, leader lock, timeline changes (failovers), replication lag, connections vs max_connections, TPS, rollback ratio, longest open transaction and database size. Requires Patroni REST /metrics and postgres_exporter scraped by Prometheus. Free alert rules and Telegram routing: https://devkit-shop.pages.dev/free/

A compact high-availability view of a Patroni-managed PostgreSQL cluster. The top row answers the first questions during an incident: is there exactly one leader, how many replicas are attached, is the leader lock missing, did a failover (timeline change) happen in the last 24 hours, and is any instance down.

Below that: replication lag, connections against max_connections, transactions per second with the rollback ratio, the longest open transaction (orange from 5 minutes, red from 30 minutes) and database size, per database.

Variables: Patroni job, postgres_exporter job, instance and database. The data source is chosen at import time. Patroni and postgres_exporter usually have different instance labels (ports 8008 and 9187), so they use separate variables.

Requirements

  • Grafana 10.0 or newer
  • Prometheus scraping Patroni (REST API /metrics, Patroni 2.1+: patroni_primary, patroni_replica, patroni_cluster_unlocked, patroni_postgres_timeline) and postgres_exporter (pg_up, pg_replication_lag_seconds, pg_stat_activity_count, pg_stat_activity_max_tx_duration, pg_settings_max_connections, pg_stat_database_*, pg_database_size_bytes)

Free alert rules + Telegram routing: https://devkit-shop.pages.dev/free/ Runbook: https://devkit-shop.pages.dev/runbook/en/

Tags: postgresql, patroni, postgres_exporter, replication, prometheus

Revisions
RevisionDescriptionCreated
PostgreSQL

PostgreSQL

by Grafana Labs
Grafana Labs solution

Easily monitor your deployment of PostgreSQL, the open source relational database, with Grafana Cloud's out-of-the-box monitoring solution.

Learn more

Get this dashboard

Import the dashboard template

or

Download JSON

Datasource
Dependencies