Skip to content

Commit c5d2f8e

Browse files
author
Jef Spaleta
committed
Merge branch 'dependabot/bundler/serverspec-tw-2.41.5' of github.com:sensu-plugins/sensu-plugins-postgres into dependabot/bundler/serverspec-tw-2.41.5
2 parents 03b8f24 + ec122a6 commit c5d2f8e

22 files changed

+96
-49
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
AllCops:
2+
TargetRubyVersion: 2.4
13

24
MethodLength:
35
Max: 200

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
66
## [Unreleased]
77
### Changes
88
- Updated development dependency to bundler ~> 2.1
9+
- Updated development dependency to rake ~> 13.0
910
- Updated runtime dependency to 'pg' '1.2.1' from 1.1
11+
- Updated runtime dependency 'dentaku' '3.3.4' from 2.04
1012

13+
### Breaking Changes
14+
- Update `sensu-plugin` dependency from `~> 1.2` to `~> 4.0` you can read the changelog entries for [4.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#400---2018-02-17), [3.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#300---2018-12-04), and [2.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#v200---2017-03-29)
1115

1216
## [3.0.0] - 2019-11-20
1317
### Breaking Changes

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
# Specify your gem's dependencies in sensu-plugins-postgres.gemspec

Rakefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler/gem_tasks'
24
require 'github/markup'
35
require 'redcarpet'
@@ -29,7 +31,7 @@ desc 'Test for binstubs'
2931
task :check_binstubs do
3032
bin_list = Gem::Specification.load('sensu-plugins-postgres.gemspec').executables
3133
bin_list.each do |b|
32-
`which #{ b }`
34+
`which #{b}`
3335
unless $CHILD_STATUS.success?
3436
puts "#{b} was not a binstub"
3537
exit

bin/check-postgres-alive.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-alive
46
#
@@ -86,6 +88,6 @@ def run
8688
rescue PG::Error => e
8789
critical "Error message: #{e.error.split("\n").first}"
8890
ensure
89-
con.close if con
91+
con&.close
9092
end
9193
end

bin/check-postgres-connections.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-connections
46
#
@@ -114,7 +116,7 @@ def run
114116
unknown "Unable to query PostgreSQL: #{e.message}"
115117
end
116118

117-
percent = (current_conns.to_f / max_conns.to_f * 100).to_i
119+
percent = (current_conns / max_conns.to_f * 100).to_i
118120

119121
if config[:use_percentage]
120122
message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{available_conns} connections"

bin/check-postgres-query.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-query
46
#

bin/check-postgres-replication.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-replication
46
#

bin/metric-postgres-connections.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# metric-postgres-connections
46
#
@@ -81,12 +83,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
8183
def run
8284
timestamp = Time.now.to_i
8385
pgpass
84-
con = PG.connect(host: config[:hostname],
85-
dbname: config[:database],
86-
user: config[:user],
87-
password: config[:password],
88-
port: config[:port],
89-
connect_timeout: config[:timeout])
86+
con = PG.connect(host: config[:hostname],
87+
dbname: config[:database],
88+
user: config[:user],
89+
password: config[:password],
90+
port: config[:port],
91+
connect_timeout: config[:timeout])
9092
request = [
9193
"select case when count(*) = 1 then 'waiting' else",
9294
"'case when wait_event_type is null then false else true end' end as wait_col",

bin/metric-postgres-dbsize.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# metric-postgres-dbsize
46
#
@@ -81,12 +83,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
8183
def run
8284
timestamp = Time.now.to_i
8385
pgpass
84-
con = PG.connect(host: config[:hostname],
85-
dbname: config[:database],
86-
user: config[:user],
87-
password: config[:password],
88-
port: config[:port],
89-
connect_timeout: config[:timeout])
86+
con = PG.connect(host: config[:hostname],
87+
dbname: config[:database],
88+
user: config[:user],
89+
password: config[:password],
90+
port: config[:port],
91+
connect_timeout: config[:timeout])
9092
request = [
9193
"select pg_database_size('#{config[:database]}')"
9294
]

0 commit comments

Comments
 (0)