sensu-plugins-postgres 1.2.0 → 1.3.0

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
2
  SHA1:
3
- metadata.gz: 3fcb3f51d636da304f46576f3c853bd2ef950f94
4
- data.tar.gz: 125a321c2baeb687ae0ef3be75082638e8846abb
3
+ metadata.gz: a1323464e435535d66a0b1576376858022278a8d
4
+ data.tar.gz: 4019c094ae4a807a0160cfc9125094eec1ceccc9
5
5
  SHA512:
6
- metadata.gz: 20c55fc65593d0c481feb05546f9f4fb7e32a609382ce3bea8ccf4f946a171f40c6a89491c07bfad19596873e696d9d0657e43421025e954ac8efd83a20e88cf
7
- data.tar.gz: 857db156200127bc186d9b6295a20afdb1883ba13d87c273b23a425d565f51c53a4f574244dd138b70cf479aa3b3240f5f9e3d24d842887b6b135ba04b240f92
6
+ metadata.gz: 85cf122222ee4acbc37ac6743e600d5af3a76c0ff81c3f9fc570883d82d9bfb0ec85cd13c2da68afdf73c3d79fea39a07385b799f86dda6487825978bbc5ed29
7
+ data.tar.gz: cc3e9ee519fdf64b8cfec6080cd5c502edc176c14cd93be807ea95a6dd6c411ad7cad17681eb4f0ae1d013bd07a78570e65d903f732dfe1722391c9f16f6090c
data/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+
8
+ ## [1.3.0] - 2017-07-25
9
+ ### Fixed
10
+ - Take into account reserved superuser connections in check-postgres-connections.rb (@Evesy)
11
+
12
+ ### Added
13
+ - Ruby 2.4.1 testing
14
+
7
15
  ## [1.2.0] - 2017-07-12
8
16
  ### Added
9
17
  - metric-postgres-statsdb.rb: Adds new metric `numbackends`. (@phumpal)
@@ -98,7 +106,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
98
106
  ### Added
99
107
  - initial release
100
108
 
101
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.2.0...HEAD
109
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.3.0...HEAD
110
+ [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.2.0...1.3.0
102
111
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.1.2...1.2.0
103
112
  [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.1.1...1.1.2
104
113
  [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.1.0...1.1.1
@@ -100,6 +100,8 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI
100
100
  port: config[:port],
101
101
  connect_timeout: config[:timeout])
102
102
  max_conns = con.exec('SHOW max_connections').getvalue(0, 0).to_i
103
+ superuser_conns = con.exec('SHOW superuser_reserved_connections').getvalue(0, 0).to_i
104
+ available_conns = max_conns - superuser_conns
103
105
  current_conns = con.exec('SELECT count(*) from pg_stat_activity').getvalue(0, 0).to_i
104
106
  rescue PG::Error => e
105
107
  unknown "Unable to query PostgreSQL: #{e.message}"
@@ -108,22 +110,22 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI
108
110
  percent = (current_conns.to_f / max_conns.to_f * 100).to_i
109
111
 
110
112
  if config[:use_percentage]
111
- message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{max_conns} connections"
113
+ message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{available_conns} connections"
112
114
  if percent >= config[:critical]
113
115
  critical message
114
116
  elsif percent >= config[:warning]
115
117
  warning message
116
118
  else
117
- ok "PostgreSQL connections under threshold: #{percent}%, #{current_conns} out of #{max_conns} connections"
119
+ ok "PostgreSQL connections under threshold: #{percent}%, #{current_conns} out of #{available_conns} connections"
118
120
  end
119
121
  else
120
- message = "PostgreSQL connections at #{current_conns} out of #{max_conns} connections"
122
+ message = "PostgreSQL connections at #{current_conns} out of #{available_conns} connections"
121
123
  if current_conns >= config[:critical]
122
124
  critical message
123
125
  elsif current_conns >= config[:warning]
124
126
  warning message
125
127
  else
126
- ok "PostgreSQL connections under threshold: #{current_conns} out of #{max_conns} connections"
128
+ ok "PostgreSQL connections under threshold: #{current_conns} out of #{available_conns} connections"
127
129
  end
128
130
  end
129
131
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsPostgres
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 2
4
+ MINOR = 3
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
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.2.0
4
+ version: 1.3.0
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-07-13 00:00:00.000000000 Z
11
+ date: 2017-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin