sensu-plugins-postgres 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -2
- data/bin/check-postgres-alive.rb +1 -0
- data/bin/check-postgres-connections.rb +7 -6
- data/bin/check-postgres-query.rb +1 -0
- data/bin/check-postgres-replication.rb +1 -0
- data/bin/metric-postgres-connections.rb +1 -0
- data/bin/metric-postgres-dbsize.rb +1 -0
- data/bin/metric-postgres-graphite.rb +2 -1
- data/bin/metric-postgres-locks.rb +1 -0
- data/bin/metric-postgres-statsbgwriter.rb +1 -0
- data/bin/metric-postgres-statsdb.rb +1 -0
- data/bin/metric-postgres-statsio.rb +1 -0
- data/bin/metric-postgres-statstable.rb +1 -0
- data/bin/metrics-postgres-query.rb +16 -2
- data/lib/sensu-plugins-postgres/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6bfd7b45d75e036b101f45450c252abf49d653b
|
4
|
+
data.tar.gz: e923b0caa1619da1cce35d8e09f53ea6dd94fd9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49df212d0fbf4c219a7e6b7b2b68375e6060151300f834ae3975e5614143f65492a8930975be15c58cb98c90f08ca8e4331f44d6d8e9a59c639f4ba88409f5aa
|
7
|
+
data.tar.gz: ddb21faebe8214bf2a55cb9e37b8e426f376110b8c3bcbd66830b277187b19c4abdf0f909bf6ca129e9c52a3d9b06b5811a7224677571b97c8eb0e46342b2a6b
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,31 @@
|
|
1
|
-
#Change Log
|
1
|
+
# Change Log
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
3
3
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.1.0] - 2017-04-20
|
9
|
+
### Added
|
10
|
+
- metrics-postgres-query.rb: Add option to return multi row queries. (@Micasou)
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- check-postgres-alive.rb: Fix connections using a custom port (#25 via @mickfeech)
|
14
|
+
- check-postgres-connections.rb: Fix connections using a custom port (#25)
|
15
|
+
- check-postgres-query.rb: Fix connections using a custom port (#25)
|
16
|
+
- check-postgres-replication.rb: Fix connections using a custom port (#25)
|
17
|
+
- metrics-postgres-connections.rb: Fix connections using a custom port (#25)
|
18
|
+
- metrics-postgres-dbsize.rb: Fix connections using a custom port (#25)
|
19
|
+
- metrics-postgres-graphite.rb: Fix connections using a custom port (#25)
|
20
|
+
- metrics-postgres-graphite.rb: Fix connections using password (@teadur)
|
21
|
+
- metrics-postgres-locks.rb: Fix connections using a custom port (#25)
|
22
|
+
- metrics-postgres-statsgbwriter.rb: Fix connections using a custom port (#25)
|
23
|
+
- metrics-postgres-statsdb.rb: Fix connections using a custom port (#25)
|
24
|
+
- metrics-postgres-statsio.rb: Fix connections using a custom port (#25)
|
25
|
+
- metrics-postgres-statstable.rb: Fix connections using a custom port (#25)
|
26
|
+
- metrics-postgres-query.rb: Fix connections using a custom port (#25)
|
27
|
+
- check-postgres-connections.rb: Fix logic to check critical first then warning (#24 via @nevins-b)
|
28
|
+
|
8
29
|
## [1.0.1] - 2017-01-04
|
9
30
|
### Fixed
|
10
31
|
- metrics-postgres-query.rb: Fix `count_tuples` option (#23) (@eheydrick)
|
@@ -66,7 +87,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
66
87
|
### Added
|
67
88
|
- initial release
|
68
89
|
|
69
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.0
|
90
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.1.0...HEAD
|
91
|
+
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.0.1...1.1.0
|
70
92
|
[1.0.1]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.0.0...1.0.1
|
71
93
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/0.1.1...1.0.0
|
72
94
|
[0.1.1]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/0.1.0...0.1.1
|
data/bin/check-postgres-alive.rb
CHANGED
@@ -97,6 +97,7 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI
|
|
97
97
|
dbname: config[:database],
|
98
98
|
user: config[:user],
|
99
99
|
password: config[:password],
|
100
|
+
port: config[:port],
|
100
101
|
connect_timeout: config[:timeout])
|
101
102
|
max_conns = con.exec('SHOW max_connections').getvalue(0, 0).to_i
|
102
103
|
current_conns = con.exec('SELECT count(*) from pg_stat_activity').getvalue(0, 0).to_i
|
@@ -108,19 +109,19 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI
|
|
108
109
|
|
109
110
|
if config[:use_percentage]
|
110
111
|
message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{max_conns} connections"
|
111
|
-
if percent >= config[:
|
112
|
-
warning message
|
113
|
-
elsif percent >= config[:critical]
|
112
|
+
if percent >= config[:critical]
|
114
113
|
critical message
|
114
|
+
elsif percent >= config[:warning]
|
115
|
+
warning message
|
115
116
|
else
|
116
117
|
ok "PostgreSQL connections under threshold: #{percent}%, #{current_conns} out of #{max_conns} connections"
|
117
118
|
end
|
118
119
|
else
|
119
120
|
message = "PostgreSQL connections at #{current_conns} out of #{max_conns} connections"
|
120
|
-
if current_conns >= config[:
|
121
|
-
warning message
|
122
|
-
elsif current_conns >= config[:critical]
|
121
|
+
if current_conns >= config[:critical]
|
123
122
|
critical message
|
123
|
+
elsif current_conns >= config[:warning]
|
124
|
+
warning message
|
124
125
|
else
|
125
126
|
ok "PostgreSQL connections under threshold: #{current_conns} out of #{max_conns} connections"
|
126
127
|
end
|
data/bin/check-postgres-query.rb
CHANGED
@@ -100,6 +100,7 @@ class CheckPostgresQuery < Sensu::Plugin::Check::CLI
|
|
100
100
|
dbname: config[:database],
|
101
101
|
user: config[:user],
|
102
102
|
password: config[:password],
|
103
|
+
port: config[:port],
|
103
104
|
connect_timeout: config[:timeout])
|
104
105
|
res = con.exec(config[:query].to_s)
|
105
106
|
rescue PG::Error => e
|
@@ -79,6 +79,7 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
79
79
|
dbname: config[:database],
|
80
80
|
user: config[:user],
|
81
81
|
password: config[:password],
|
82
|
+
port: config[:port],
|
82
83
|
connect_timeout: config[:timeout])
|
83
84
|
request = [
|
84
85
|
"select case when count(*) = 1 then 'waiting' else",
|
@@ -79,6 +79,7 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
79
79
|
dbname: config[:database],
|
80
80
|
user: config[:user],
|
81
81
|
password: config[:password],
|
82
|
+
port: config[:port],
|
82
83
|
connect_timeout: config[:timeout])
|
83
84
|
request = [
|
84
85
|
"select pg_database_size('#{config[:database]}')"
|
@@ -53,7 +53,7 @@ class CheckpostgresReplicationStatus < Sensu::Plugin::Metric::CLI::Graphite
|
|
53
53
|
long: '--username=VALUE',
|
54
54
|
description: 'Database username'
|
55
55
|
|
56
|
-
option :
|
56
|
+
option :password,
|
57
57
|
short: '-p',
|
58
58
|
long: '--password=VALUE',
|
59
59
|
description: 'Database password'
|
@@ -82,6 +82,7 @@ class CheckpostgresReplicationStatus < Sensu::Plugin::Metric::CLI::Graphite
|
|
82
82
|
dbname: config[:database],
|
83
83
|
user: config[:user],
|
84
84
|
password: config[:password],
|
85
|
+
port: config[:port],
|
85
86
|
connect_timeout: config[:timeout])
|
86
87
|
res1 = conn_master.exec('SELECT pg_current_xlog_location()').getvalue(0, 0)
|
87
88
|
m_segbytes = conn_master.exec('SHOW wal_segment_size').getvalue(0, 0).sub(/\D+/, '').to_i << 20
|
@@ -81,6 +81,7 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
81
81
|
dbname: config[:database],
|
82
82
|
user: config[:user],
|
83
83
|
password: config[:password],
|
84
|
+
port: config[:port],
|
84
85
|
connect_timeout: config[:timeout])
|
85
86
|
request = [
|
86
87
|
'SELECT mode, count(mode) FROM pg_locks',
|
@@ -73,6 +73,7 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
73
73
|
dbname: 'postgres',
|
74
74
|
user: config[:user],
|
75
75
|
password: config[:password],
|
76
|
+
port: config[:port],
|
76
77
|
connect_timeout: config[:timeout])
|
77
78
|
request = [
|
78
79
|
'select checkpoints_timed, checkpoints_req,',
|
@@ -80,6 +80,7 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
80
80
|
dbname: config[:database],
|
81
81
|
user: config[:user],
|
82
82
|
password: config[:password],
|
83
|
+
port: config[:port],
|
83
84
|
connect_timeout: config[:timeout])
|
84
85
|
request = [
|
85
86
|
'select xact_commit, xact_rollback,',
|
@@ -86,6 +86,7 @@ class PostgresStatsIOMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
86
86
|
dbname: config[:database],
|
87
87
|
user: config[:user],
|
88
88
|
password: config[:password],
|
89
|
+
port: config[:port],
|
89
90
|
connect_timeout: config[:timeout])
|
90
91
|
request = [
|
91
92
|
'select sum(heap_blks_read) as heap_blks_read, sum(heap_blks_hit) as heap_blks_hit,',
|
@@ -86,6 +86,7 @@ class PostgresStatsTableMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
86
86
|
dbname: config[:database],
|
87
87
|
user: config[:user],
|
88
88
|
password: config[:password],
|
89
|
+
port: config[:port],
|
89
90
|
connect_timeout: config[:timeout])
|
90
91
|
request = [
|
91
92
|
'select sum(seq_scan) as seq_scan, sum(seq_tup_read) as seq_tup_read,',
|
@@ -78,6 +78,13 @@ class MetricsPostgresQuery < Sensu::Plugin::Metric::CLI::Graphite
|
|
78
78
|
long: '--scheme SCHEME',
|
79
79
|
default: 'postgres'
|
80
80
|
|
81
|
+
option :multirow,
|
82
|
+
description: 'Determines if we return first row or all rows',
|
83
|
+
short: '-m',
|
84
|
+
long: '--multirow',
|
85
|
+
boolean: true,
|
86
|
+
default: false
|
87
|
+
|
81
88
|
option :timeout,
|
82
89
|
description: 'Connection timeout (seconds)',
|
83
90
|
short: '-T TIMEOUT',
|
@@ -90,6 +97,7 @@ class MetricsPostgresQuery < Sensu::Plugin::Metric::CLI::Graphite
|
|
90
97
|
dbname: config[:database],
|
91
98
|
user: config[:user],
|
92
99
|
password: config[:password],
|
100
|
+
port: config[:port],
|
93
101
|
connect_timeout: config[:timeout])
|
94
102
|
res = con.exec(config[:query].to_s)
|
95
103
|
rescue PG::Error => e
|
@@ -99,10 +107,16 @@ class MetricsPostgresQuery < Sensu::Plugin::Metric::CLI::Graphite
|
|
99
107
|
value = if config[:count_tuples]
|
100
108
|
res.ntuples
|
101
109
|
else
|
102
|
-
res.
|
110
|
+
res.values
|
103
111
|
end
|
104
112
|
|
105
|
-
|
113
|
+
if config[:multirow] && !config[:count_tuples]
|
114
|
+
value.each do |row|
|
115
|
+
output "#{config[:scheme]}.#{row[0]}", row[1]
|
116
|
+
end
|
117
|
+
else
|
118
|
+
output config[:scheme], value
|
119
|
+
end
|
106
120
|
ok
|
107
121
|
end
|
108
122
|
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.0
|
4
|
+
version: 1.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: 2017-
|
11
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -225,7 +225,7 @@ homepage: https://github.com/sensu-plugins/sensu-plugins-postgres
|
|
225
225
|
licenses:
|
226
226
|
- MIT
|
227
227
|
metadata:
|
228
|
-
maintainer:
|
228
|
+
maintainer: sensu-plugin
|
229
229
|
development_status: active
|
230
230
|
production_status: unstable - testing recommended
|
231
231
|
release_draft: 'false'
|