sensu-plugins-gluster 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8ef69863f94146ecc3af78de2ae8b71901b47bf9
4
- data.tar.gz: 6d26d722afb308cc76d5577cb6ea79f24960e6fc
2
+ SHA256:
3
+ metadata.gz: db2a816acb8a108049a73c4da3ff3d5a73a1a0d8b7b5c950e507d782669b056e
4
+ data.tar.gz: c4a565a9d266117332b3feb486ad5a09942307f607c7cb382c40d13c5a01564e
5
5
  SHA512:
6
- metadata.gz: 432bb6a3c3511971914e9d85d8cd30eaae3bc428b5fb10e5e7d9d0e9c4c9b60f86e927eb973a39df3d6f72521ee4296abd9cc26fa80cc8c0af653ef6f706de41
7
- data.tar.gz: bd90b13bfd7d4ee6090d4f20b5b91c1e4f489dc4027809bb34692d92da930dca0d056a60f819688be25ca4ca55984ef80648b328da333c353348e400bc465f0a
6
+ metadata.gz: ece576cef6f56a7713af181af974914d4ad942432b00c077138fba2517d6ec00f012b8d6b9ce4180770c8e0cde08773d594601d12b85e75fae423a7633975743
7
+ data.tar.gz: db7b0447a9cbb22696fa374a9a475f83e23e2177c5d5d36a8e021791f5e5bc102a2a6ef50d3d37f658bc65ff3a1a1296da4ee1f44e874b7d74fd9163f960c80c
@@ -1,10 +1,26 @@
1
1
  #Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.0.0] - 2018-04-18
9
+ ### Breaking Changes
10
+ - dropped ruby 2.0 support (@yuri-zubov sponsored by Actility, https://www.actility.com)
11
+ - added `nokogiri` as a dependency which requires you to have a local c compiler present to install this plugin (@yuri-zubov sponsored by Actility, https://www.actility.com)
12
+ - added `nori` as a dependency which requires you to have a local c compiler present to install this plugin (@yuri-zubov sponsored by Actility, https://www.actility.com)
13
+
14
+ ### Security
15
+ - updated yard dependency to `~> 0.9.11` per: https://nvd.nist.gov/vuln/detail/CVE-2017-17042 (@yuri-zubov sponsored by Actility, https://www.actility.com)
16
+ - updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@yuri-zubov sponsored by Actility, https://www.actility.com)
17
+
18
+ ### Added
19
+ - Added ability to get metrics from gluster (@yuri-zubov sponsored by Actility, https://www.actility.com)
20
+
21
+ ### Changed
22
+ - updated changelog guidelines location (@majormoses)
23
+
8
24
  ## [1.0.0] - 2017-07-15
9
25
  ### Added
10
26
  - Ruby 2.3.0 testing
@@ -26,7 +42,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
26
42
  ### Added
27
43
  - initial release
28
44
 
29
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-gluster/compare/1.0.0...HEAD
45
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-gluster/compare/2.0.0...HEAD
46
+ [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-gluster/compare/1.0.0...2.0.0
30
47
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-gluster/compare/0.0.3...1.0.0
31
48
  [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-gluster/compare/0.0.2...0.0.3
32
49
  [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-gluster/compare/0.0.1...0.0.2
@@ -0,0 +1,62 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-vertx
4
+ #
5
+ # DESCRIPTION:
6
+ # metrics-vertx get metrics from VertX
7
+ #
8
+ # OUTPUT:
9
+ # metric-data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: rest-clien
16
+ #
17
+ # USAGE:
18
+ #
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Zubov Yuri <yury.zubau@gmail.com> sponsored by Actility, https://www.actility.com
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/metric/cli'
29
+ require 'open3'
30
+ require 'socket'
31
+ require 'nokogiri'
32
+ require 'nori'
33
+ require 'sensu-plugins-gluster'
34
+
35
+ class MetricsGlusterPeerStatus < Sensu::Plugin::Metric::CLI::Graphite
36
+ include CommonGluster
37
+
38
+ option :scheme,
39
+ description: 'Metric naming scheme, text to prepend to metric',
40
+ short: '-S SCHEME',
41
+ long: '--scheme SCHEME',
42
+ default: "#{Socket.gethostname}.gluster"
43
+
44
+ def request
45
+ stdout, result = Open3.capture2('gluster peer status --xml')
46
+ unknown 'Unable to get gluster status' unless result.success?
47
+ stdout
48
+ end
49
+
50
+ def nokogiri_parse
51
+ xml_doc = Nokogiri::XML(request)
52
+
53
+ response = xml_doc.xpath('//peerStatus').to_s
54
+ response_hash = Nori.new.parse(response)['peerStatus']
55
+ array_to_naming_hash([response_hash['peer']].flatten, 'uuid', %w[state connected])
56
+ end
57
+
58
+ def run
59
+ print_hash(nokogiri_parse)
60
+ ok
61
+ end
62
+ end
@@ -0,0 +1,69 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-vertx
4
+ #
5
+ # DESCRIPTION:
6
+ # metrics-vertx get metrics from VertX
7
+ #
8
+ # OUTPUT:
9
+ # metric-data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: rest-clien
16
+ #
17
+ # USAGE:
18
+ #
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Zubov Yuri <yury.zubau@gmail.com> sponsored by Actility, https://www.actility.com
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/metric/cli'
29
+ require 'open3'
30
+ require 'socket'
31
+ require 'nori'
32
+ require 'nokogiri'
33
+ require 'sensu-plugins-gluster'
34
+
35
+ class MetricsGlusterVolumeInfo < Sensu::Plugin::Metric::CLI::Graphite
36
+ include CommonGluster
37
+
38
+ option :scheme,
39
+ description: 'Metric naming scheme, text to prepend to metric',
40
+ short: '-S SCHEME',
41
+ long: '--scheme SCHEME',
42
+ default: "#{Socket.gethostname}.gluster"
43
+
44
+ def request
45
+ stdout, result = Open3.capture2('gluster volume info --xml')
46
+ unknown 'Unable to get gluster status' unless result.success?
47
+ stdout
48
+ end
49
+
50
+ def nokogiri_parse
51
+ xml_doc = Nokogiri::XML(request)
52
+
53
+ response = xml_doc.xpath('//volumes').to_s
54
+ response_hash = Nori.new.parse(response)['volumes']
55
+ array_to_naming_hash(
56
+ [response_hash['volume']].flatten,
57
+ 'name',
58
+ %w[
59
+ name status statusStr snapshotCount brickCount distCount
60
+ stripeCount replicaCount arbiterCount disperseCount redundancyCount
61
+ ]
62
+ ).merge('volumes.count' => response_hash['count'])
63
+ end
64
+
65
+ def run
66
+ print_hash(nokogiri_parse)
67
+ ok
68
+ end
69
+ end
@@ -0,0 +1,79 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-vertx
4
+ #
5
+ # DESCRIPTION:
6
+ # metrics-vertx get metrics from VertX
7
+ #
8
+ # OUTPUT:
9
+ # metric-data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: rest-clien
16
+ #
17
+ # USAGE:
18
+ #
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Zubov Yuri <yury.zubau@gmail.com> sponsored by Actility, https://www.actility.com
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/metric/cli'
29
+ require 'open3'
30
+ require 'socket'
31
+ require 'nori'
32
+ require 'nokogiri'
33
+ require 'sensu-plugins-gluster'
34
+
35
+ class MetricsGlusterVolumeProfile < Sensu::Plugin::Metric::CLI::Graphite
36
+ include CommonGluster
37
+
38
+ option :scheme,
39
+ description: 'Metric naming scheme, text to prepend to metric',
40
+ short: '-S SCHEME',
41
+ long: '--scheme SCHEME',
42
+ default: "#{Socket.gethostname}.gluster"
43
+
44
+ option :name,
45
+ description: 'Name of value',
46
+ short: '-N NAME',
47
+ long: '--name NAME',
48
+ required: true
49
+
50
+ def request
51
+ stdout, result = Open3.capture2("gluster volume profile #{config[:name]} info cumulative --xml")
52
+ unknown 'Unable to get gluster status' unless result.success?
53
+ stdout
54
+ end
55
+
56
+ def nokogiri_parse
57
+ xml_doc = Nokogiri::XML(request)
58
+
59
+ response = xml_doc.xpath('//volProfile').to_s
60
+ response_hash = Nori.new.parse(response)['volProfile']
61
+ [response_hash['brick']].flatten.map do |value|
62
+ [
63
+ value['brickName'],
64
+ {
65
+ 'block.size' => array_to_naming_hash(value['cumulativeStats']['blockStats']['block'], 'size'),
66
+ 'fop.name' => array_to_naming_hash(value['cumulativeStats']['fopStats']['fop'], 'name'),
67
+ 'duration' => value['cumulativeStats']['duration'],
68
+ 'totalRead' => value['cumulativeStats']['duration'],
69
+ 'totalWrite' => value['cumulativeStats']['duration']
70
+ }
71
+ ]
72
+ end.to_h
73
+ end
74
+
75
+ def run
76
+ print_hash(nokogiri_parse)
77
+ ok
78
+ end
79
+ end
@@ -0,0 +1,74 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-vertx
4
+ #
5
+ # DESCRIPTION:
6
+ # metrics-vertx get metrics from VertX
7
+ #
8
+ # OUTPUT:
9
+ # metric-data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: rest-clien
16
+ #
17
+ # USAGE:
18
+ #
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Zubov Yuri <yury.zubau@gmail.com> sponsored by Actility, https://www.actility.com
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/metric/cli'
29
+ require 'open3'
30
+ require 'socket'
31
+ require 'nori'
32
+ require 'nokogiri'
33
+ require 'sensu-plugins-gluster'
34
+
35
+ class MetricsGlusterVolumeStatus < Sensu::Plugin::Metric::CLI::Graphite
36
+ include CommonGluster
37
+
38
+ option :scheme,
39
+ description: 'Metric naming scheme, text to prepend to metric',
40
+ short: '-S SCHEME',
41
+ long: '--scheme SCHEME',
42
+ default: "#{Socket.gethostname}.gluster"
43
+
44
+ def request
45
+ stdout, result = Open3.capture2('gluster volume status all detail --xml')
46
+ unknown 'Unable to get gluster status' unless result.success?
47
+ stdout
48
+ end
49
+
50
+ def nokogiri_parse
51
+ xml_doc = Nokogiri::XML(request)
52
+
53
+ response = xml_doc.xpath('//volumes').to_s
54
+ response_hash = Nori.new.parse(response)['volumes']
55
+ [response_hash['volume']].flatten.map do |value|
56
+ [
57
+ value['volName'],
58
+ {
59
+ 'nodeCount' => value['nodeCount'],
60
+ 'node' => array_to_naming_hash(
61
+ value['node'],
62
+ 'hostname',
63
+ %w[status sizeTotal sizeFree blockSize inodesTotal inodesFree]
64
+ )
65
+ }
66
+ ]
67
+ end.to_h
68
+ end
69
+
70
+ def run
71
+ print_hash(nokogiri_parse)
72
+ ok
73
+ end
74
+ end
@@ -1 +1,2 @@
1
+ require 'sensu-plugins-gluster/common_gluster'
1
2
  require 'sensu-plugins-gluster/version'
@@ -0,0 +1,24 @@
1
+ module CommonGluster
2
+ def print_hash(hash, path = '')
3
+ hash.each do |key, value|
4
+ new_path = "#{path}.#{key}"
5
+ if value.is_a? Hash
6
+ print_hash(value, new_path)
7
+ else
8
+ output "#{config[:scheme]}#{new_path}", value unless value.nil? || value.empty?
9
+ end
10
+ end
11
+ false
12
+ end
13
+
14
+ def array_to_naming_hash(array, key_name, filter_keys = nil)
15
+ array.map do |item|
16
+ filtered_hash = if filter_keys.nil?
17
+ item
18
+ else
19
+ item.select { |key, _| filter_keys.include? key }
20
+ end
21
+ [item.delete(key_name), filtered_hash]
22
+ end.to_h
23
+ end
24
+ end
@@ -1,6 +1,6 @@
1
1
  module SensuPluginsGluster
2
2
  module Version
3
- MAJOR = 1
3
+ MAJOR = 2
4
4
  MINOR = 0
5
5
  PATCH = 0
6
6
 
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-gluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.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-15 00:00:00.000000000 Z
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nori
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: sensu-plugin
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -109,52 +137,70 @@ dependencies:
109
137
  - !ruby/object:Gem::Version
110
138
  version: '3.2'
111
139
  - !ruby/object:Gem::Dependency
112
- name: rubocop
140
+ name: rspec
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - "~>"
116
144
  - !ruby/object:Gem::Version
117
- version: 0.40.0
145
+ version: '3.7'
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
- version: 0.40.0
152
+ version: '3.7'
125
153
  - !ruby/object:Gem::Dependency
126
- name: rspec
154
+ name: rspec-mocks
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '3.7'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '3.7'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop
127
169
  requirement: !ruby/object:Gem::Requirement
128
170
  requirements:
129
171
  - - "~>"
130
172
  - !ruby/object:Gem::Version
131
- version: '3.4'
173
+ version: 0.51.0
132
174
  type: :development
133
175
  prerelease: false
134
176
  version_requirements: !ruby/object:Gem::Requirement
135
177
  requirements:
136
178
  - - "~>"
137
179
  - !ruby/object:Gem::Version
138
- version: '3.4'
180
+ version: 0.51.0
139
181
  - !ruby/object:Gem::Dependency
140
182
  name: yard
141
183
  requirement: !ruby/object:Gem::Requirement
142
184
  requirements:
143
185
  - - "~>"
144
186
  - !ruby/object:Gem::Version
145
- version: '0.8'
187
+ version: 0.9.11
146
188
  type: :development
147
189
  prerelease: false
148
190
  version_requirements: !ruby/object:Gem::Requirement
149
191
  requirements:
150
192
  - - "~>"
151
193
  - !ruby/object:Gem::Version
152
- version: '0.8'
194
+ version: 0.9.11
153
195
  description: Sensu gluster plugins
154
196
  email: "<sensu-users@googlegroups.com>"
155
197
  executables:
156
198
  - check-gluster-georepl-status.rb
157
199
  - check-gluster-status.rb
200
+ - metrics-gluster-peer-status.rb
201
+ - metrics-gluster-volume-info.rb
202
+ - metrics-gluster-volume-profile.rb
203
+ - metrics-gluster-volume-status.rb
158
204
  extensions: []
159
205
  extra_rdoc_files: []
160
206
  files:
@@ -163,7 +209,12 @@ files:
163
209
  - README.md
164
210
  - bin/check-gluster-georepl-status.rb
165
211
  - bin/check-gluster-status.rb
212
+ - bin/metrics-gluster-peer-status.rb
213
+ - bin/metrics-gluster-volume-info.rb
214
+ - bin/metrics-gluster-volume-profile.rb
215
+ - bin/metrics-gluster-volume-status.rb
166
216
  - lib/sensu-plugins-gluster.rb
217
+ - lib/sensu-plugins-gluster/common_gluster.rb
167
218
  - lib/sensu-plugins-gluster/version.rb
168
219
  homepage: https://github.com/sensu-plugins/sensu-plugins-gluster
169
220
  licenses:
@@ -191,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
242
  version: '0'
192
243
  requirements: []
193
244
  rubyforge_project:
194
- rubygems_version: 2.4.5
245
+ rubygems_version: 2.7.6
195
246
  signing_key:
196
247
  specification_version: 4
197
248
  summary: Sensu plugins for gluster