From 69c8208e3cb28147be8be13eb53e2c185d97ad42 Mon Sep 17 00:00:00 2001 From: Motte <37443982+dmotte@users.noreply.github.com> Date: Thu, 27 Mar 2025 14:42:22 +0100 Subject: [PATCH] Added PostgresqlReplicationLagHigh rule (#456) * Added PostgresqlReplicationLagHigh rule * Update PostgreSQL replication lag alert settings --------- Co-authored-by: Samuel Berthe --- _data/rules.yml | 5 +++++ dist/rules/postgresql/postgres-exporter.yml | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/_data/rules.yml b/_data/rules.yml index 8fa80f3..7e75921 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -747,6 +747,11 @@ groups: for: 6h comments: | See https://github.com/samber/awesome-prometheus-alerts/issues/289#issuecomment-1164842737 + - name: Postgresql replication lag high + description: The PostgreSQL replication lag is high (> 60s) + query: "pg_replication_lag_seconds > 5" + severity: warning + for: 30s - name: SQL Server exporters: diff --git a/dist/rules/postgresql/postgres-exporter.yml b/dist/rules/postgresql/postgres-exporter.yml index 42e5bb8..b52dddd 100644 --- a/dist/rules/postgresql/postgres-exporter.yml +++ b/dist/rules/postgresql/postgres-exporter.yml @@ -192,3 +192,12 @@ groups: annotations: summary: Postgresql invalid index (instance {{ $labels.instance }}) description: "The table {{ $labels.relname }} has an invalid index: {{ $labels.indexrelname }}. You should execute `DROP INDEX {{ $labels.indexrelname }};`\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" + + - alert: PostgresqlReplicationLagHigh + expr: 'pg_replication_lag_seconds > 60' + for: 2m + labels: + severity: warning + annotations: + summary: Postgresql replication lag high (> 60s) (instance {{ $labels.instance }}) + description: "The PostgreSQL replication lag is high\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"