From a099e2f8333859c9e848324bcacf431612a851b6 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 15 Jul 2024 12:49:55 +0200 Subject: [PATCH] Retrieve master connection info using "SHOW primary_conninfo" SQL query instead of parsing recovery.conf --- check_pg_streaming_replication | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_pg_streaming_replication b/check_pg_streaming_replication index 0cd18a4..378fa5b 100755 --- a/check_pg_streaming_replication +++ b/check_pg_streaming_replication @@ -305,11 +305,11 @@ then debug "Last replayed LSN: $LAST_REPLAYED_LSN" - # Get master connection information from recovery.conf file - MASTER_CONN_INFOS=$( egrep '^ *primary_conninfo' $RECOVERY_CONF|sed "s/^ *primary_conninfo *= *\(.\+\) *$/\1/" ) + # Get master connection information from primary_conninfo configuration parameter + MASTER_CONN_INFOS=$( psql_get "SHOW primary_conninfo" ) if [ ! -n "$MASTER_CONN_INFOS" ] then - echo "UNKNOWN: Can't retrieve master connection information form recovery.conf file" + echo "UNKNOWN: Can't retrieve master connection information from primary_conninfo configuration parameter" exit 3 fi debug "Master connection information: $MASTER_CONN_INFOS"