sensu-plugins-sensu 2.1.1 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a41669c0e26a07efba58456daa34b954a6b5fd2a
4
- data.tar.gz: dee205425b435940dc7cc0a7259c5809db7ecbbb
3
+ metadata.gz: c35936006dfebb7842bdb342ee2f16efb7150e24
4
+ data.tar.gz: 38f8364250b1d8c065095c8062e0acfbfb8f3e1c
5
5
  SHA512:
6
- metadata.gz: 85edf389d8f682d779c59df352607039d787dc3890b075d4e996f91458f4ad6d79af45b69b40690efbe0fa13a4543ea59e3f5d7c59f2c495dec32961d3d421ec
7
- data.tar.gz: 57c3945315d07a507a57a774656884f483ab2e683a87ac230c241b615b7a14662dda3bdec20ceb63f66820c052b0f1eba31fb301226da489d4de33c3c912a405
6
+ metadata.gz: b13cc8882d0697c011905651d9979fc29b4a9aa4677a7aff415942c6e3ac4115d4bc16817b0bec6b62a9f6d50b6165cd666103d3b1d9e478c271a16618b22003
7
+ data.tar.gz: 09fc225e9e570259bf63e77911fcb58f7117147e0211ecbfd21c88e2972d8c3566a7f1c7f438abc6311927efbea4cf8a5095e169d014dcd14e67328518414c6a
@@ -6,6 +6,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.2.0] - 2017-09-16
10
+ ### Changed
11
+ - check-aggregates.rb: Add options `--stale-percentage` and `--stale-count` to warn on stale data (@rbanffy)
12
+
9
13
  ## [2.1.1] - 2017-00-09
10
14
  ### Fixed
11
15
  - metrics-aggregates.rb: Refactored to support new named aggregates introduced in Sensu 0.24 (@oba11)
@@ -78,7 +82,8 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
78
82
  ### Added
79
83
  - initial release
80
84
 
81
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.1.0...HEAD
85
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.2.0...HEAD
86
+ [2.2.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.1.0...2.2.0
82
87
  [2.1.1]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.1.0...2.1.1
83
88
  [2.1.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.0.0...2.1.0
84
89
  [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/1.1.1...2.0.0
@@ -130,6 +130,16 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
130
130
  boolean: true,
131
131
  default: false
132
132
 
133
+ option :stale_percentage,
134
+ long: '--stale-percentage PERCENT',
135
+ description: 'PERCENT stale before warning',
136
+ proc: proc(&:to_i)
137
+
138
+ option :stale_count,
139
+ long: '--stale-count INTEGER',
140
+ description: 'number of nodes with stale data before warning',
141
+ proc: proc(&:to_i)
142
+
133
143
  def api_request(resource)
134
144
  verify_mode = OpenSSL::SSL::VERIFY_PEER
135
145
  verify_mode = OpenSSL::SSL::VERIFY_NONE if config[:insecure]
@@ -280,6 +290,23 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
280
290
  end
281
291
  end
282
292
 
293
+ def compare_stale(aggregate)
294
+ message = config[:message] || 'Number of stale results exceeds threshold'
295
+ message += " (%s out of #{aggregate[:total]} nodes reporting %s)"
296
+ message += "\n" + aggregate[:outputs] if aggregate[:outputs]
297
+
298
+ if config[:stale_percentage]
299
+ percent_stale = (aggregate[:stale].to_f / aggregate[:total].to_f * 100).to_i
300
+ if percent_stale >= config[:stale_percentage]
301
+ warning format(message, percent_stale.to_s + '%', 'stale')
302
+ end
303
+ elsif config[:stale_count]
304
+ if aggregate[:stale] >= config[:stale_count]
305
+ warning format(message, aggregate[:stale].to_s, 'stale')
306
+ end
307
+ end
308
+ end
309
+
283
310
  def run
284
311
  threshold = config[:critical] || config[:warning]
285
312
  threshold_count = config[:critical_count] || config[:warning_count]
@@ -293,6 +320,7 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
293
320
  compare_thresholds(aggregate) if threshold
294
321
  compare_pattern(aggregate) if pattern
295
322
  compare_thresholds_count(aggregate) if threshold_count
323
+ compare_stale(aggregate) if config[:stale_percentage] || config[:stale_count]
296
324
 
297
325
  ok 'Aggregate looks GOOD'
298
326
  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 = 1
6
- PATCH = 1
5
+ MINOR = 2
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.1.1
4
+ version: 2.2.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-09-09 00:00:00.000000000 Z
11
+ date: 2017-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin