File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
This CHANGELOG follows the format listed [ here] ( https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md ) .
5
5
6
6
## [ Unreleased]
7
+ ### Fixed
8
+ - check-postgres-replication.rb: maintains backwards compatibility with <= 9.6 and adds compatibility for >= 10
7
9
8
10
## [ 1.4.2] - 2017-09-27
9
11
### Fixed
Original file line number Diff line number Diff line change @@ -117,7 +117,13 @@ def run
117
117
sslmode : ssl_mode ,
118
118
connect_timeout : config [ :timeout ] )
119
119
120
- master = conn_master . exec ( 'SELECT pg_current_xlog_location()' ) . getvalue ( 0 , 0 )
120
+ begin
121
+ # PostgreSQL 10
122
+ master = conn_master . exec ( 'SELECT pg_current_wal_lsn()' ) . getvalue ( 0 , 0 )
123
+ rescue
124
+ # PostgreSQL <= 9.6
125
+ master = conn_master . exec ( 'SELECT pg_current_xlog_location()' ) . getvalue ( 0 , 0 )
126
+ end
121
127
m_segbytes = conn_master . exec ( 'SHOW wal_segment_size' ) . getvalue ( 0 , 0 ) . sub ( /\D +/ , '' ) . to_i << 20
122
128
conn_master . close
123
129
@@ -130,7 +136,13 @@ def run
130
136
sslmode : ssl_mode ,
131
137
connect_timeout : config [ :timeout ] )
132
138
133
- slave = conn_slave . exec ( 'SELECT pg_last_xlog_receive_location()' ) . getvalue ( 0 , 0 )
139
+ begin
140
+ # PostgreSQL 10
141
+ slave = conn_slave . exec ( 'SELECT pg_last_wal_replay_lsn()' ) . getvalue ( 0 , 0 )
142
+ rescue
143
+ # PostgreSQL <= 9.6
144
+ slave = conn_slave . exec ( 'SELECT pg_last_xlog_receive_location()' ) . getvalue ( 0 , 0 )
145
+ end
134
146
conn_slave . close
135
147
136
148
# Computing lag
You can’t perform that action at this time.
0 commit comments