sensu-plugins-postgres 2.4.0 → 4.1.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 +4 -4
- data/CHANGELOG.md +41 -1
- data/bin/check-postgres-alive.rb +3 -1
- data/bin/check-postgres-connections.rb +3 -1
- data/bin/check-postgres-query.rb +9 -0
- data/bin/check-postgres-replication.rb +12 -6
- data/bin/metric-postgres-connections.rb +8 -6
- data/bin/metric-postgres-dbsize.rb +8 -6
- data/bin/metric-postgres-graphite.rb +2 -0
- data/bin/metric-postgres-locks.rb +8 -6
- data/bin/metric-postgres-statsbgwriter.rb +8 -6
- data/bin/metric-postgres-statsdb.rb +2 -0
- data/bin/metric-postgres-statsio.rb +8 -6
- data/bin/metric-postgres-statstable.rb +8 -6
- data/bin/metric-postgres-vaccum.rb +124 -0
- data/bin/metrics-postgres-query.rb +3 -1
- data/lib/sensu-plugins-postgres.rb +2 -0
- data/lib/sensu-plugins-postgres/pgpass.rb +3 -0
- data/lib/sensu-plugins-postgres/pgutil.rb +2 -0
- data/lib/sensu-plugins-postgres/version.rb +4 -2
- metadata +23 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d435ce57d91a2e6a71c1971cd1602f19b82004f70f82aa498770c110c8bf266
|
4
|
+
data.tar.gz: 64ddf283f041bd5b70eac42d7433e8a0dad64226858723e4e8c56a5f983f819f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d91e6b7648feab7e75431930bc7a739448276d233df4c2afd8cb9084ebbbb488878ab5a5936422355fcb9a34dcec6699db279afeeee52798b66390d32761bcb8
|
7
|
+
data.tar.gz: 824cc884e247f23a9ffdb0aa60e4e3a90bda1fd2e4d10badcbaf8934d6e08fa77d00a53599c8331ea209381696923779d8d7bb9f433c5aeee78ec6418df4150b
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,41 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [4.1.0] - 2020-06-04
|
9
|
+
### Added
|
10
|
+
- new `metric-postgres-vaccum.rb` metric gathering script for postgres vacuum process (@phumpal)
|
11
|
+
|
12
|
+
## [4.0.2] - 2020-06-02
|
13
|
+
- Fixed `# frozen_string_literal: true` does not play nicely with mixlib-cli.
|
14
|
+
|
15
|
+
## [4.0.1] - 2020-04-20
|
16
|
+
### Fixed
|
17
|
+
- Fixing asset build directives.
|
18
|
+
|
19
|
+
## [4.0.0] - 2020-01-09
|
20
|
+
|
21
|
+
### Breaking Changes
|
22
|
+
- 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)
|
23
|
+
- `check-postgres-replication.rb`: both `--slave-host` and `master-host` arguments are now required flags where previously they had localhost defaults (@phumpal)
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
- `check-postgres-replication.rb`: fix condition where connection timeout is considered a boolean rather than an integer value (@majormoses) (@phumpal) (@VeselaHouba)
|
27
|
+
- `check-postgres-replication.rb`: critical if the master and slave are same (@phumpal)
|
28
|
+
|
29
|
+
### Added
|
30
|
+
- `check-postgres-query.rb`: Add `-r`, `--regex-pattern` to match query result against (@jindraj)
|
31
|
+
|
32
|
+
### Changes
|
33
|
+
- Updated development dependency to bundler ~> 2.1
|
34
|
+
- Updated development dependency to rake ~> 13.0
|
35
|
+
- Updated development dependency to test-kitchen ~> 1.25.0
|
36
|
+
- Updated runtime dependency to 'pg' '1.2.1' from 1.1
|
37
|
+
- Updated runtime dependency 'dentaku' '3.3.4' from 2.04
|
38
|
+
|
39
|
+
## [3.0.0] - 2019-11-20
|
40
|
+
### Breaking Changes
|
41
|
+
- Removed ruby < 2.4 since these Rubies are EOL (@phumpal)
|
42
|
+
|
8
43
|
## [2.4.0] - 2019-10-04
|
9
44
|
### Added
|
10
45
|
- Support comments in pgpass file. Keeps previous behavior and adds support for ignoring leading comments (@phumpal)
|
@@ -182,7 +217,12 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
182
217
|
### Added
|
183
218
|
- initial release
|
184
219
|
|
185
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/
|
220
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/4.1.0...HEAD
|
221
|
+
[4.1.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/4.0.2...4.1.0
|
222
|
+
[4.0.2]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/4.0.1...4.0.2
|
223
|
+
[4.0.1]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/4.0.0...4.0.1
|
224
|
+
[4.0.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/3.0.0...4.0.0
|
225
|
+
[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/2.4.0...3.0.0
|
186
226
|
[2.4.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/2.3.2...2.4.0
|
187
227
|
[2.3.2]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/2.3.1...2.3.2
|
188
228
|
[2.3.1]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/2.3.0...2.3.1
|
data/bin/check-postgres-alive.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-postgres-alive
|
4
6
|
#
|
@@ -86,6 +88,6 @@ class CheckPostgres < Sensu::Plugin::Check::CLI
|
|
86
88
|
rescue PG::Error => e
|
87
89
|
critical "Error message: #{e.error.split("\n").first}"
|
88
90
|
ensure
|
89
|
-
con
|
91
|
+
con&.close
|
90
92
|
end
|
91
93
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-postgres-connections
|
4
6
|
#
|
@@ -114,7 +116,7 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI
|
|
114
116
|
unknown "Unable to query PostgreSQL: #{e.message}"
|
115
117
|
end
|
116
118
|
|
117
|
-
percent = (current_conns
|
119
|
+
percent = (current_conns / max_conns.to_f * 100).to_i
|
118
120
|
|
119
121
|
if config[:use_percentage]
|
120
122
|
message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{available_conns} connections"
|
data/bin/check-postgres-query.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-postgres-query
|
4
6
|
#
|
@@ -73,6 +75,11 @@ class CheckPostgresQuery < Sensu::Plugin::Check::CLI
|
|
73
75
|
long: '--query QUERY',
|
74
76
|
required: true
|
75
77
|
|
78
|
+
option :regex_pattern,
|
79
|
+
description: 'Regex pattern to match on query results and alert on if it does not match',
|
80
|
+
short: '-r REGEX',
|
81
|
+
long: '--regex-pattern REGEX'
|
82
|
+
|
76
83
|
option :check_tuples,
|
77
84
|
description: 'Check against the number of tuples (rows) returned by the query',
|
78
85
|
short: '-t',
|
@@ -125,6 +132,8 @@ class CheckPostgresQuery < Sensu::Plugin::Check::CLI
|
|
125
132
|
critical "Results: #{res.values}"
|
126
133
|
elsif config[:warning] && calc.evaluate(config[:warning], value: value)
|
127
134
|
warning "Results: #{res.values}"
|
135
|
+
elsif config[:regex_pattern] && (res.getvalue(0, 0) !~ /#{config[:regex_pattern]}/)
|
136
|
+
critical "Query result #{res.getvalue(0, 0)} doesn't match configured regex #{config[:regex_pattern]}"
|
128
137
|
else
|
129
138
|
ok 'Query OK'
|
130
139
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-postgres-replication
|
4
6
|
#
|
@@ -41,13 +43,14 @@ class CheckPostgresReplicationStatus < Sensu::Plugin::Check::CLI
|
|
41
43
|
option(:master_host,
|
42
44
|
short: '-m',
|
43
45
|
long: '--master-host=HOST',
|
46
|
+
required: true,
|
44
47
|
description: 'PostgreSQL master HOST')
|
45
48
|
|
46
49
|
option(:slave_host,
|
47
50
|
short: '-s',
|
48
51
|
long: '--slave-host=HOST',
|
49
|
-
|
50
|
-
|
52
|
+
required: true,
|
53
|
+
description: 'PostgreSQL slave HOST')
|
51
54
|
|
52
55
|
option(:port,
|
53
56
|
short: '-P',
|
@@ -92,10 +95,11 @@ class CheckPostgresReplicationStatus < Sensu::Plugin::Check::CLI
|
|
92
95
|
proc: lambda { |s| s.to_i }) # rubocop:disable Lambda
|
93
96
|
|
94
97
|
option(:timeout,
|
95
|
-
short: '-T',
|
96
|
-
long: '--timeout',
|
97
|
-
default:
|
98
|
-
description: 'Connection timeout (seconds)'
|
98
|
+
short: '-T TIMEOUT',
|
99
|
+
long: '--timeout=TIMEOUT',
|
100
|
+
default: 2,
|
101
|
+
description: 'Connection timeout (seconds)',
|
102
|
+
proc: proc(&:to_i))
|
99
103
|
|
100
104
|
include Pgpass
|
101
105
|
include PgUtil
|
@@ -103,6 +107,8 @@ class CheckPostgresReplicationStatus < Sensu::Plugin::Check::CLI
|
|
103
107
|
def run
|
104
108
|
ssl_mode = config[:ssl] ? 'require' : 'prefer'
|
105
109
|
|
110
|
+
critical 'Master and slave cannot be the same host' if config[:master_host] == config[:slave_host]
|
111
|
+
|
106
112
|
# Establishing connection to the master
|
107
113
|
pgpass
|
108
114
|
conn_master = PG.connect(host: config[:master_host],
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# metric-postgres-connections
|
4
6
|
#
|
@@ -81,12 +83,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
81
83
|
def run
|
82
84
|
timestamp = Time.now.to_i
|
83
85
|
pgpass
|
84
|
-
con
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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])
|
90
92
|
request = [
|
91
93
|
"select case when count(*) = 1 then 'waiting' else",
|
92
94
|
"'case when wait_event_type is null then false else true end' end as wait_col",
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# metric-postgres-dbsize
|
4
6
|
#
|
@@ -81,12 +83,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
81
83
|
def run
|
82
84
|
timestamp = Time.now.to_i
|
83
85
|
pgpass
|
84
|
-
con
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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])
|
90
92
|
request = [
|
91
93
|
"select pg_database_size('#{config[:database]}')"
|
92
94
|
]
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# metric-postgres-locks
|
4
6
|
#
|
@@ -83,12 +85,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
83
85
|
|
84
86
|
locks_per_type = Hash.new(0)
|
85
87
|
pgpass
|
86
|
-
con
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
con = PG.connect(host: config[:hostname],
|
89
|
+
dbname: config[:database],
|
90
|
+
user: config[:user],
|
91
|
+
password: config[:password],
|
92
|
+
port: config[:port],
|
93
|
+
connect_timeout: config[:timeout])
|
92
94
|
request = [
|
93
95
|
'SELECT mode, count(mode) AS count FROM pg_locks',
|
94
96
|
"WHERE database = (SELECT oid FROM pg_database WHERE datname = '#{config[:database]}')",
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# metric-postgres-statsbgwriter
|
4
6
|
#
|
@@ -76,12 +78,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
76
78
|
def run
|
77
79
|
timestamp = Time.now.to_i
|
78
80
|
pgpass
|
79
|
-
con
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
con = PG.connect(host: config[:hostname],
|
82
|
+
dbname: 'postgres',
|
83
|
+
user: config[:user],
|
84
|
+
password: config[:password],
|
85
|
+
port: config[:port],
|
86
|
+
connect_timeout: config[:timeout])
|
85
87
|
request = [
|
86
88
|
'select checkpoints_timed, checkpoints_req,',
|
87
89
|
'checkpoint_write_time, checkpoint_sync_time,',
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# metric-postgres-statsio
|
4
6
|
#
|
@@ -88,12 +90,12 @@ class PostgresStatsIOMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
88
90
|
def run
|
89
91
|
timestamp = Time.now.to_i
|
90
92
|
pgpass
|
91
|
-
con
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
con = PG.connect(host: config[:hostname],
|
94
|
+
dbname: config[:database],
|
95
|
+
user: config[:user],
|
96
|
+
password: config[:password],
|
97
|
+
port: config[:port],
|
98
|
+
connect_timeout: config[:timeout])
|
97
99
|
request = [
|
98
100
|
'select sum(heap_blks_read) as heap_blks_read, sum(heap_blks_hit) as heap_blks_hit,',
|
99
101
|
'sum(idx_blks_read) as idx_blks_read, sum(idx_blks_hit) as idx_blks_hit,',
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# metric-postgres-statstable
|
4
6
|
#
|
@@ -88,12 +90,12 @@ class PostgresStatsTableMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
88
90
|
def run
|
89
91
|
timestamp = Time.now.to_i
|
90
92
|
pgpass
|
91
|
-
con
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
con = PG.connect(host: config[:hostname],
|
94
|
+
dbname: config[:database],
|
95
|
+
user: config[:user],
|
96
|
+
password: config[:password],
|
97
|
+
port: config[:port],
|
98
|
+
connect_timeout: config[:timeout])
|
97
99
|
request = [
|
98
100
|
'select sum(seq_scan) as seq_scan, sum(seq_tup_read) as seq_tup_read,',
|
99
101
|
'sum(idx_scan) as idx_scan, sum(idx_tup_fetch) as idx_tup_fetch,',
|
@@ -0,0 +1,124 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# DEPENDENCIES:
|
5
|
+
# gem: sensu-plugin
|
6
|
+
# gem: pg
|
7
|
+
#
|
8
|
+
# USAGE:
|
9
|
+
# ./metric-postgres-vaccum.rb -u db_user -p db_pass -h db_host -d db
|
10
|
+
#
|
11
|
+
# NOTES:
|
12
|
+
# Requires PSQL `track_counts` `track_io_timing` for some metrics enabled
|
13
|
+
#
|
14
|
+
# LICENSE:
|
15
|
+
# Copyright (c) 2020 Airbrake Technologies, Inc <support@airbrake.io>
|
16
|
+
# Author Patrick Humpal <patrick@netvilla.net>
|
17
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
18
|
+
# for details.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'sensu-plugins-postgres/pgpass'
|
22
|
+
require 'sensu-plugin/metric/cli'
|
23
|
+
require 'pg'
|
24
|
+
require 'socket'
|
25
|
+
|
26
|
+
class PostgresVacuumDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
27
|
+
option :pgpass,
|
28
|
+
description: 'Pgpass file',
|
29
|
+
short: '-f FILE',
|
30
|
+
long: '--pgpass',
|
31
|
+
default: ENV['PGPASSFILE'] || "#{ENV['HOME']}/.pgpass"
|
32
|
+
|
33
|
+
option :user,
|
34
|
+
description: 'Postgres User',
|
35
|
+
short: '-u USER',
|
36
|
+
long: '--user USER'
|
37
|
+
|
38
|
+
option :password,
|
39
|
+
description: 'Postgres Password',
|
40
|
+
short: '-p PASS',
|
41
|
+
long: '--password PASS'
|
42
|
+
|
43
|
+
option :hostname,
|
44
|
+
description: 'Hostname to login to',
|
45
|
+
short: '-h HOST',
|
46
|
+
long: '--hostname HOST'
|
47
|
+
|
48
|
+
option :port,
|
49
|
+
description: 'Database port',
|
50
|
+
short: '-P PORT',
|
51
|
+
long: '--port PORT'
|
52
|
+
|
53
|
+
option :database,
|
54
|
+
description: 'Database to connect on',
|
55
|
+
short: '-d DB',
|
56
|
+
long: '--db DB',
|
57
|
+
default: 'postgres'
|
58
|
+
|
59
|
+
option :all_databases,
|
60
|
+
description: 'Get stats for all available databases',
|
61
|
+
short: '-a',
|
62
|
+
long: '--all-databases',
|
63
|
+
boolean: true,
|
64
|
+
default: false
|
65
|
+
|
66
|
+
option :scheme,
|
67
|
+
description: 'Metric naming scheme, text to prepend to $queue_name.$metric',
|
68
|
+
long: '--scheme SCHEME',
|
69
|
+
default: "#{Socket.gethostname}.postgresql"
|
70
|
+
|
71
|
+
option :timeout,
|
72
|
+
description: 'Connection timeout (seconds)',
|
73
|
+
short: '-T TIMEOUT',
|
74
|
+
long: '--timeout TIMEOUT',
|
75
|
+
default: nil
|
76
|
+
|
77
|
+
include Pgpass
|
78
|
+
|
79
|
+
def phase_mapping(vacuum_phase)
|
80
|
+
['initializing',
|
81
|
+
'scanning heap',
|
82
|
+
'vacuuming indexes',
|
83
|
+
'vacuuming heap',
|
84
|
+
'cleaning up indexes',
|
85
|
+
'truncating heap',
|
86
|
+
'performing final cleanup'].find_index(vacuum_phase)
|
87
|
+
end
|
88
|
+
|
89
|
+
def run
|
90
|
+
timestamp = Time.now.to_i
|
91
|
+
pgpass
|
92
|
+
con = PG.connect(host: config[:hostname],
|
93
|
+
dbname: config[:database],
|
94
|
+
user: config[:user],
|
95
|
+
password: config[:password],
|
96
|
+
port: config[:port],
|
97
|
+
connect_timeout: config[:timeout])
|
98
|
+
|
99
|
+
query = 'SELECT * FROM pg_stat_progress_vacuum'
|
100
|
+
params = []
|
101
|
+
unless config[:all_databases]
|
102
|
+
query += ' WHERE datname = $1'
|
103
|
+
params.push config[:database]
|
104
|
+
end
|
105
|
+
|
106
|
+
con.exec_params(query, params) do |result|
|
107
|
+
result.each do |row|
|
108
|
+
database = row['datname']
|
109
|
+
|
110
|
+
row.each do |key, value|
|
111
|
+
next if %w[datid datname].include?(key)
|
112
|
+
|
113
|
+
if key == 'phase'
|
114
|
+
output "#{config[:scheme]}.vacuum.#{database}.phase", phase_mapping(value).to_s, timestamp
|
115
|
+
else
|
116
|
+
output "#{config[:scheme]}.vacuum.#{database}.#{key}", value.to_s, timestamp
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
ok
|
123
|
+
end
|
124
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# metrics-postgres-query
|
4
6
|
#
|
@@ -114,7 +116,7 @@ class MetricsPostgresQuery < Sensu::Plugin::Metric::CLI::Graphite
|
|
114
116
|
value = if config[:count_tuples]
|
115
117
|
res.ntuples
|
116
118
|
else
|
117
|
-
res.first
|
119
|
+
res.first&.values&.first
|
118
120
|
end
|
119
121
|
|
120
122
|
if config[:multirow] && !config[:count_tuples]
|
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:
|
4
|
+
version: 4.1.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:
|
11
|
+
date: 2020-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dentaku
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.3.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 3.3.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pg
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.2.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.2.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1
|
61
|
+
version: '2.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1
|
68
|
+
version: '2.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: codeclimate-test-reporter
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,22 +126,16 @@ dependencies:
|
|
126
126
|
name: mixlib-shellout
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "<"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 2.3.0
|
132
129
|
- - "~>"
|
133
130
|
- !ruby/object:Gem::Version
|
134
|
-
version: '2.
|
131
|
+
version: '2.4'
|
135
132
|
type: :development
|
136
133
|
prerelease: false
|
137
134
|
version_requirements: !ruby/object:Gem::Requirement
|
138
135
|
requirements:
|
139
|
-
- - "<"
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: 2.3.0
|
142
136
|
- - "~>"
|
143
137
|
- !ruby/object:Gem::Version
|
144
|
-
version: '2.
|
138
|
+
version: '2.4'
|
145
139
|
- !ruby/object:Gem::Dependency
|
146
140
|
name: pry
|
147
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,14 +156,14 @@ dependencies:
|
|
162
156
|
requirements:
|
163
157
|
- - "~>"
|
164
158
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
159
|
+
version: '13.0'
|
166
160
|
type: :development
|
167
161
|
prerelease: false
|
168
162
|
version_requirements: !ruby/object:Gem::Requirement
|
169
163
|
requirements:
|
170
164
|
- - "~>"
|
171
165
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
166
|
+
version: '13.0'
|
173
167
|
- !ruby/object:Gem::Dependency
|
174
168
|
name: redcarpet
|
175
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,42 +198,42 @@ dependencies:
|
|
204
198
|
requirements:
|
205
199
|
- - "~>"
|
206
200
|
- !ruby/object:Gem::Version
|
207
|
-
version: 0.
|
201
|
+
version: 0.79.0
|
208
202
|
type: :development
|
209
203
|
prerelease: false
|
210
204
|
version_requirements: !ruby/object:Gem::Requirement
|
211
205
|
requirements:
|
212
206
|
- - "~>"
|
213
207
|
- !ruby/object:Gem::Version
|
214
|
-
version: 0.
|
208
|
+
version: 0.79.0
|
215
209
|
- !ruby/object:Gem::Dependency
|
216
210
|
name: serverspec
|
217
211
|
requirement: !ruby/object:Gem::Requirement
|
218
212
|
requirements:
|
219
213
|
- - "~>"
|
220
214
|
- !ruby/object:Gem::Version
|
221
|
-
version: 2.
|
215
|
+
version: 2.41.5
|
222
216
|
type: :development
|
223
217
|
prerelease: false
|
224
218
|
version_requirements: !ruby/object:Gem::Requirement
|
225
219
|
requirements:
|
226
220
|
- - "~>"
|
227
221
|
- !ruby/object:Gem::Version
|
228
|
-
version: 2.
|
222
|
+
version: 2.41.5
|
229
223
|
- !ruby/object:Gem::Dependency
|
230
224
|
name: test-kitchen
|
231
225
|
requirement: !ruby/object:Gem::Requirement
|
232
226
|
requirements:
|
233
227
|
- - "~>"
|
234
228
|
- !ruby/object:Gem::Version
|
235
|
-
version: 1.
|
229
|
+
version: 1.25.0
|
236
230
|
type: :development
|
237
231
|
prerelease: false
|
238
232
|
version_requirements: !ruby/object:Gem::Requirement
|
239
233
|
requirements:
|
240
234
|
- - "~>"
|
241
235
|
- !ruby/object:Gem::Version
|
242
|
-
version: 1.
|
236
|
+
version: 1.25.0
|
243
237
|
- !ruby/object:Gem::Dependency
|
244
238
|
name: yard
|
245
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,6 +270,7 @@ executables:
|
|
276
270
|
- metric-postgres-locks.rb
|
277
271
|
- metric-postgres-statsbgwriter.rb
|
278
272
|
- check-postgres-replication.rb
|
273
|
+
- metric-postgres-vaccum.rb
|
279
274
|
extensions: []
|
280
275
|
extra_rdoc_files: []
|
281
276
|
files:
|
@@ -294,6 +289,7 @@ files:
|
|
294
289
|
- bin/metric-postgres-statsdb.rb
|
295
290
|
- bin/metric-postgres-statsio.rb
|
296
291
|
- bin/metric-postgres-statstable.rb
|
292
|
+
- bin/metric-postgres-vaccum.rb
|
297
293
|
- bin/metrics-postgres-query.rb
|
298
294
|
- lib/sensu-plugins-postgres.rb
|
299
295
|
- lib/sensu-plugins-postgres/pgpass.rb
|
@@ -317,7 +313,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
317
313
|
requirements:
|
318
314
|
- - ">="
|
319
315
|
- !ruby/object:Gem::Version
|
320
|
-
version: 2.
|
316
|
+
version: 2.4.0
|
321
317
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
322
318
|
requirements:
|
323
319
|
- - ">="
|