Better way to monitor for failed replication?

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Better way to monitor for failed replication?
Date: 2026-01-09 15:50:28
Message-ID: CANzqJaBG-MkG9YTt8pYTnHu+9U5wpwEcWQKzx2aOu85C6Uzn-w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Currently, in a bash script, I run this SELECT statement against the
Primary server which is supposed to replicate to multiple servers. If
active == f, I send an alter email.

postgres=# SELECT rs.slot_name, rs.active, sr.client_hostname
from pg_replication_slots rs
left outer join pg_stat_replication sr on rs.active_pid = sr.pid;
slot_name | active | client_hostname
--------------+--------+-----------------
pgstandby1 | t | BBOPITCPGS302B
replicate_dr | f |
(2 rows)

Is there a better way to check for replication that's supposed to be
happening, but isn't (like PG on the replica was stopped for some reason)?

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Keith 2026-01-09 17:41:57 Re: Better way to monitor for failed replication?
Previous Message Dharin Shah 2026-01-06 17:55:07 Re: Is PgAudit extension database specific?