Script to check replication - Mailing list pgsql-general

From Ashish Chauhan
Subject Script to check replication
Date
Msg-id 6837D32772C03D42BF09864A2DACFF9B1D3195A0@dcmail02.supportsoft.com
Whole thread Raw
Responses Re: Script to check replication
List pgsql-general

Hi,

 

We are running Streaming replication with Hot standby in our current production. I do have below script to check replication status and replication lag. Does anyone have script which runs every 15 mins to check replication status and send out email if replication is not running or lagging behind.

 

SELECT pg_last_xlog_receive_location() receive, pg_last_xlog_replay_location() replay, now() - pg_last_xact_replay_timestamp() AS replication_delay, (extract(epoch FROM now()) -   extract(epoch FROM pg_last_xact_replay_timestamp()))::int lag

 

Thanks for your help!

 

Thanks,

Ashish Chauhan

 

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Re: "missing chunk number XX for toast value YY in pg_toast ..." after pg_basebackup.
Next
From: "David Bennett"
Date:
Subject: Re: Does a call to a language handler provide a context/session, and somewhere to keep session data?