From ea72d093996aa1108c290b8e76c28a89321779a3 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 4 Nov 2020 15:16:39 +0100 Subject: [PATCH] Adjust recovery control function names for PG > 10 --- check_pg_streaming_replication | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/check_pg_streaming_replication b/check_pg_streaming_replication index 7afae93..18418e9 100755 --- a/check_pg_streaming_replication +++ b/check_pg_streaming_replication @@ -213,11 +213,15 @@ REPLAY_CRITICAL_DELAY = $REPLAY_CRITICAL_DELAY # Set some stuff to PostgreSQL version if [ $( echo "$PG_VERSION < 10" |bc -l ) -eq 1 ] then + pg_last_wal_receive_lsn='pg_last_xlog_receive_location()' + pg_last_wal_replay_lsn='pg_last_xlog_replay_location()' pg_current_wal_lsn='pg_current_xlog_location()' pg_wal_lsn_diff='pg_xlog_location_diff' sent_lsn='sent_location' write_lsn='write_location' else + pg_last_wal_receive_lsn='pg_last_wal_receive_lsn()' + pg_last_wal_replay_lsn='pg_last_wal_replay_lsn()' pg_current_wal_lsn='pg_current_wal_lsn()' pg_wal_lsn_diff='pg_wal_lsn_diff' sent_lsn='sent_lsn' @@ -253,9 +257,9 @@ then fi debug "Postgres is in recovery mode" - LAST_XLOG_RECEIVE=$( psql_get "SELECT pg_last_xlog_receive_location()" ) + LAST_XLOG_RECEIVE=$( psql_get "SELECT $pg_last_wal_receive_lsn" ) debug "Last xlog file receive : $LAST_XLOG_RECEIVE" - LAST_XLOG_REPLAY=$( psql_get "SELECT pg_last_xlog_replay_location()" ) + LAST_XLOG_REPLAY=$( psql_get "SELECT $pg_last_wal_replay_lsn" ) debug "Last xlog file replay : $LAST_XLOG_REPLAY"