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.