sensu-plugins-postgres 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e9eb754d56e7a8ade27af0fb36aeb08d0f3633e9
4
- data.tar.gz: ad88363188072fcb94db781a5572d52f6cb50b84
2
+ SHA256:
3
+ metadata.gz: a42537adea3f4fa7958b100624e00a1a82e9318e6d6fb82952ef3d420fb14593
4
+ data.tar.gz: 584b7909ab8262f52be389fa02b3c2d15769658c060e9d1462d8b4e669251f58
5
5
  SHA512:
6
- metadata.gz: affc3257c83dff3ec5c102329e999e3d8a3c61f0ca15fac497d79507683d91cb163103970d90a985602bb9f277cee18bc2ed24679b51b529ff26dfc062413899
7
- data.tar.gz: 4ec0f25b880fbd08427d4d55b508611b12ae7a6fd27922045c3fe2bfbf062a115639db3f05f38c7c3890c594351beba08447d271e979827ef1066ecdeee0dabf
6
+ metadata.gz: f333dd44d54068df93ad996d193a51c313081207d7122d3c60c6d7bf3e7fc0a705d5e93e32b8cbf267323f2caae1f6de4552544cfce2aa8cee28744cba864ee2
7
+ data.tar.gz: 73f45d5d317001185db035e3cbd5591207e4011cbc3fc91b313ac847b599d943377cdd0776a57b244a3e04f16677790d5ea882495587736d4b4bcd7b2f224019
data/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.4.4] - 2017-11-08
9
+ ### Fixed
10
+ - check-postgres-replication.rb: fix 9.x compatibility
11
+
12
+ ## [1.4.3] - 2017-11-06
13
+ ### Fixed
14
+ - check-postgres-replication.rb: maintains backwards compatibility with <= 9.6 and adds compatibility for >= 10
15
+
8
16
  ## [1.4.2] - 2017-09-27
9
17
  ### Fixed
10
18
  - metric-postgres-locks.rb: Fix lock count collection (@madboxkr)
@@ -122,7 +130,9 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
122
130
  ### Added
123
131
  - initial release
124
132
 
125
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.4.2...HEAD
133
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.4.4...HEAD
134
+ [1.4.4]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.4.3...1.4.4
135
+ [1.4.3]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.4.2...1.4.3
126
136
  [1.4.2]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.4.1...1.4.2
127
137
  [1.4.1]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.4.0...1.4.1
128
138
  [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.3.0...1.4.0
@@ -104,6 +104,11 @@ class CheckPostgresReplicationStatus < Sensu::Plugin::Check::CLI
104
104
  ((m_segment.hex - s_segment.hex) * m_segbytes) + (m_offset.hex - s_offset.hex)
105
105
  end
106
106
 
107
+ def check_vsn(conn)
108
+ pg_vsn = conn.exec("SELECT current_setting('server_version')").getvalue(0, 0)
109
+ Gem::Version.new(pg_vsn) < Gem::Version.new('10.0') && Gem::Version.new(pg_vsn) >= Gem::Version.new('9.0')
110
+ end
111
+
107
112
  def run
108
113
  ssl_mode = config[:ssl] ? 'require' : 'prefer'
109
114
 
@@ -117,7 +122,11 @@ class CheckPostgresReplicationStatus < Sensu::Plugin::Check::CLI
117
122
  sslmode: ssl_mode,
118
123
  connect_timeout: config[:timeout])
119
124
 
120
- master = conn_master.exec('SELECT pg_current_xlog_location()').getvalue(0, 0)
125
+ master = if check_vsn(conn_master)
126
+ conn_master.exec('SELECT pg_current_xlog_location()').getvalue(0, 0)
127
+ else
128
+ conn_master.exec('SELECT pg_current_wal_lsn()').getvalue(0, 0)
129
+ end
121
130
  m_segbytes = conn_master.exec('SHOW wal_segment_size').getvalue(0, 0).sub(/\D+/, '').to_i << 20
122
131
  conn_master.close
123
132
 
@@ -130,7 +139,11 @@ class CheckPostgresReplicationStatus < Sensu::Plugin::Check::CLI
130
139
  sslmode: ssl_mode,
131
140
  connect_timeout: config[:timeout])
132
141
 
133
- slave = conn_slave.exec('SELECT pg_last_xlog_receive_location()').getvalue(0, 0)
142
+ slave = if check_vsn(conn_slave)
143
+ conn_slave.exec('SELECT pg_last_xlog_receive_location()').getvalue(0, 0)
144
+ else
145
+ conn_slave.exec('SELECT pg_last_wal_replay_lsn()').getvalue(0, 0)
146
+ end
134
147
  conn_slave.close
135
148
 
136
149
  # Computing lag
@@ -2,7 +2,7 @@ module SensuPluginsPostgres
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 4
5
- PATCH = 2
5
+ PATCH = 4
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2017-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubyforge_project:
251
- rubygems_version: 2.6.13
251
+ rubygems_version: 2.7.2
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: Sensu plugins for postgres