sensu-plugins-edgelab 1.18.4 → 1.18.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -6
  3. data/bin/metrics-postgres-statsdb.rb +0 -111
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d69148597eecc8e890508809750fffc64d841ef7a1c2c45930da151bececc23
4
- data.tar.gz: 5e7fa4fea33721e8eafe936c9ac20b55bfaae1bcfdb0ab3a0f3bfc9736dd6134
3
+ metadata.gz: f4865abee645041b5b0710d7d5144e4b8b779a72b0f96635d6746cd013776678
4
+ data.tar.gz: c45cf06c8fbbc4d308f27ed4c4a5e1364263bd6aed6de81c784dfe2e036ef0cf
5
5
  SHA512:
6
- metadata.gz: 1cdd49b81483f19f4014ed20831d730d97513b53066e8cdb1d413f79604b224d8468713817e313e6bc355734bc92542f103ce9eba424e8915e4fa26294f1eae8
7
- data.tar.gz: 62c224e081680bca8be7d5c8788d950a4786b6ba0b7ea19385bdb9416bd25932efe16f505d0f83fbf89fd34ebaaec352536e83da483132d38b3dd9ed54d24965
6
+ metadata.gz: a667dde58a8d07a408ad56e3f36c22378bdd4e69b9755ae03e71d3cae5902d1b15434c2f31f4dfeb48b190082e29bf9035ee6328bc622ce23cd43be5353ddbc6
7
+ data.tar.gz: 687e932c3967b53eb3148eacaede0d3b4d3adb70cf7aadd6737b8c914da686fd4bf0e857d7d1f74eb64d691cdb04d8be7909ba53ba6120ee491291bfdca192a2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-edgelab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.4
4
+ version: 1.18.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgelab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cassandra-driver
@@ -213,7 +213,6 @@ executables:
213
213
  - metrics-postgres-connections.rb
214
214
  - check-nomad-leader.rb
215
215
  - check-cassandra-nodes.rb
216
- - metrics-postgres-statsdb.rb
217
216
  - check-logstash-pipeline.rb
218
217
  - handler-multi-hipchat.rb
219
218
  - metrics-es-indices.rb
@@ -241,7 +240,6 @@ files:
241
240
  - bin/metrics-cassandra-basic.rb
242
241
  - bin/metrics-es-indices.rb
243
242
  - bin/metrics-postgres-connections.rb
244
- - bin/metrics-postgres-statsdb.rb
245
243
  - bin/metrics-redis-key-pattern.rb
246
244
  - bin/metrics-swarm-cluster.rb
247
245
  homepage:
@@ -262,8 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
260
  - !ruby/object:Gem::Version
263
261
  version: '0'
264
262
  requirements: []
265
- rubyforge_project:
266
- rubygems_version: 2.7.8
263
+ rubygems_version: 3.0.2
267
264
  signing_key:
268
265
  specification_version: 4
269
266
  summary: Contains Edgelab plugins for Sensu
@@ -1,111 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # metric-postgres-statsdb
4
- #
5
- # DESCRIPTION:
6
- #
7
- # This plugin collects postgres database metrics from the pg_stat_database table
8
- #
9
- # OUTPUT:
10
- # metric data
11
- #
12
- # PLATFORMS:
13
- # Linux
14
- #
15
- # DEPENDENCIES:
16
- # gem: sensu-plugin
17
- # gem: pg
18
- #
19
- # USAGE:
20
- # ./metric-postgres-statsdb.rb -u db_user -p db_pass -h db_host -d db
21
- #
22
- # NOTES:
23
- # Requires PSQL `track_counts` `track_io_timing` for some metrics enabled
24
- #
25
- # LICENSE:
26
- # Copyright (c) 2012 Kwarter, Inc <platforms@kwarter.com>
27
- # Author Gilles Devaux <gilles.devaux@gmail.com>
28
- # Released under the same terms as Sensu (the MIT license); see LICENSE
29
- # for details.
30
- #
31
-
32
- require 'sensu-plugin/metric/cli'
33
- require 'pg'
34
- require 'socket'
35
-
36
- class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
37
- option :user,
38
- description: 'Postgres User',
39
- short: '-u USER',
40
- long: '--user USER'
41
-
42
- option :password,
43
- description: 'Postgres Password',
44
- short: '-p PASS',
45
- long: '--password PASS'
46
-
47
- option :hostname,
48
- description: 'Hostname to login to',
49
- short: '-h HOST',
50
- long: '--hostname HOST'
51
-
52
- option :port,
53
- description: 'Database port',
54
- short: '-P PORT',
55
- long: '--port PORT'
56
-
57
- option :database,
58
- description: 'Database to connect on',
59
- short: '-d DB',
60
- long: '--db DB',
61
- default: 'postgres'
62
-
63
- option :all_databases,
64
- description: 'Get stats for all the databases instead of only the one we are connected on.',
65
- short: '-a',
66
- long: '--all-databases',
67
- boolean: true,
68
- default: false
69
-
70
- option :scheme,
71
- description: 'Metric naming scheme, text to prepend to $queue_name.$metric',
72
- long: '--scheme SCHEME',
73
- default: "#{Socket.gethostname}.postgresql"
74
-
75
- option :timeout,
76
- description: 'Connection timeout (seconds)',
77
- short: '-T TIMEOUT',
78
- long: '--timeout TIMEOUT',
79
- default: nil
80
-
81
- def run
82
- timestamp = Time.now.to_i
83
- con = PG.connect(host: config[:hostname],
84
- dbname: config[:database],
85
- user: config[:user],
86
- password: config[:password],
87
- port: config[:port],
88
- connect_timeout: config[:timeout])
89
-
90
- query = 'SELECT datname, * FROM pg_stat_database'
91
- params = []
92
- unless config[:all_databases]
93
- query += ' WHERE datname = $1'
94
- params.append config[:database]
95
- end
96
-
97
- con.exec_params(query, params) do |result|
98
- result.each do |row|
99
- database = row['datname']
100
-
101
- row.each do |key, value|
102
- next if %w[datid datname stats_reset].include?(key)
103
-
104
- output "#{config[:scheme]}.statsdb.#{database}.#{key}", value.to_s, timestamp
105
- end
106
- end
107
- end
108
-
109
- ok
110
- end
111
- end