sensu-plugins-sensu 2.3.1 → 2.4.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
2
  SHA1:
3
- metadata.gz: 9ea6a3cda96f3ff8e4b8e6cccc24f93acfff7386
4
- data.tar.gz: 29398cd8f33ec212f1e3b348e94994a238d8adde
3
+ metadata.gz: c0f7c7aa6934af44de715311900e9ab3663ca102
4
+ data.tar.gz: 2d8836d088e11c69a0ebd9cd319f8ed3960c9a93
5
5
  SHA512:
6
- metadata.gz: 72af635c76e791b051c415b32d7e87923bcf4a66110cd6b0e8305e4e0b3751faf90caf0143d880a1bf75853ec152e0afb55c05eb177676637173c0f5010b01af
7
- data.tar.gz: 3be770e376eac98af320e75dd66ddd82bff48ea1a5b2ed612f456609620e07c784170bdc55c993c487e08e2211a60444a70d4076148c80b47c72db9e365f46f8
6
+ metadata.gz: 6873fec7d2ad254a5a087f2703d22bd8c3a526acfb6f1ba475ac244b45296af5a648beb5a6ad62941b94daef82ac98301b2599aa127e7fb834e79126a7279f59
7
+ data.tar.gz: f9dbe703320e5b1550fed23abbb810971a09a6906dfa9a042614f7a866dfc8cc39557a9658160f2ed9fc3ca8c523186964a2a32569c7d01b84a3790b70f92354
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.4.0] - 2017-10-12
10
+ ### Added
11
+ - `--debug` Option to display results hash at end of output message.
12
+ ### Changed
13
+ - Previously the results hash were always displayed before the message, now they are displayed at the end of the message and only if the `--debug` option is used.
14
+
9
15
  ## [2.3.1] - 2017-10-06
10
16
  ### Changed
11
17
  - check-stale-results.rb: update the require order for json so that it comes after sensu_plugin (@barryorourke)
@@ -100,6 +106,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
100
106
  - initial release
101
107
 
102
108
  [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.3.1...HEAD
109
+ [2.4.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.3.1...2.4.0
103
110
  [2.3.1]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.3.0...2.3.1
104
111
  [2.3.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.2.2...2.3.0
105
112
  [2.2.2]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.2.1...2.2.2
@@ -130,6 +130,13 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
130
130
  boolean: true,
131
131
  default: false
132
132
 
133
+ option :debug,
134
+ short: '-D',
135
+ long: '--debug',
136
+ description: 'Display results hash at end of output message',
137
+ boolean: true,
138
+ default: false
139
+
133
140
  option :stale_percentage,
134
141
  long: '--stale-percentage PERCENT',
135
142
  description: 'PERCENT stale before warning',
@@ -228,7 +235,9 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
228
235
  message = config[:message] || 'Number of non-zero results exceeds threshold'
229
236
  message += ' (%d%% %s)'
230
237
  message += "\n" + aggregate[:outputs] if aggregate[:outputs]
231
-
238
+ if config[:debug]
239
+ message += "\n" + aggregate.to_s
240
+ end
232
241
  if config[:ignore_severity]
233
242
  percent_non_zero = (100 - (aggregate[:ok].to_f / aggregate[:total].to_f) * 100).to_i
234
243
  if config[:critical] && percent_non_zero >= config[:critical]
@@ -251,6 +260,9 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
251
260
  regex = Regexp.new(config[:pattern])
252
261
  mappings = {}
253
262
  message = config[:message] || 'One of these is not like the others!'
263
+ if config[:debug]
264
+ message += "\n" + aggregate.to_s
265
+ end
254
266
  aggregate[:outputs].each do |output, _count|
255
267
  matched = regex.match(output.to_s)
256
268
  unless matched.nil?
@@ -270,7 +282,9 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
270
282
  message = config[:message] || 'Number of nodes down exceeds threshold'
271
283
  message += " (%s out of #{aggregate[:total]} nodes reporting %s)"
272
284
  message += "\n" + aggregate[:outputs] if aggregate[:outputs]
273
-
285
+ if config[:debug]
286
+ message += "\n" + aggregate.to_s
287
+ end
274
288
  if config[:ignore_severity]
275
289
  number_of_nodes_reporting_down = aggregate[:total].to_i - aggregate[:ok].to_i
276
290
  if config[:critical_count] && number_of_nodes_reporting_down >= config[:critical_count]
@@ -315,13 +329,16 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
315
329
 
316
330
  aggregate = acquire_aggregate
317
331
  aggregate = honor_stash(aggregate) if config[:honor_stash]
318
- puts aggregate
319
332
  aggregate = collect_output(aggregate) if config[:collect_output]
320
333
  compare_thresholds(aggregate) if threshold
321
334
  compare_pattern(aggregate) if pattern
322
335
  compare_thresholds_count(aggregate) if threshold_count
323
336
  compare_stale(aggregate) if config[:stale_percentage] || config[:stale_count]
324
337
 
325
- ok 'Aggregate looks GOOD'
338
+ if config[:debug]
339
+ ok "Aggregate looks GOOD\n" + aggregate.to_s
340
+ else
341
+ ok 'Aggregate looks Good'
342
+ end
326
343
  end
327
344
  end
@@ -2,8 +2,8 @@ module SensuPluginsSensu
2
2
  # This defines the version of the gem
3
3
  module Version
4
4
  MAJOR = 2
5
- MINOR = 3
6
- PATCH = 1
5
+ MINOR = 4
6
+ PATCH = 0
7
7
 
8
8
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-sensu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.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-10-07 00:00:00.000000000 Z
11
+ date: 2017-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.8.0
41
- - !ruby/object:Gem::Dependency
42
- name: english
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.6.3
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 0.6.3
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: chronic_duration
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -245,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
231
  version: '0'
246
232
  requirements: []
247
233
  rubyforge_project:
248
- rubygems_version: 2.6.13
234
+ rubygems_version: 2.6.14
249
235
  signing_key:
250
236
  specification_version: 4
251
237
  summary: Sensu plugins for sensu