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 +4 -4
- data/CHANGELOG.md +6 -1
- data/bin/check-aggregate.rb +28 -0
- data/lib/sensu-plugins-sensu/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c35936006dfebb7842bdb342ee2f16efb7150e24
|
4
|
+
data.tar.gz: 38f8364250b1d8c065095c8062e0acfbfb8f3e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b13cc8882d0697c011905651d9979fc29b4a9aa4677a7aff415942c6e3ac4115d4bc16817b0bec6b62a9f6d50b6165cd666103d3b1d9e478c271a16618b22003
|
7
|
+
data.tar.gz: 09fc225e9e570259bf63e77911fcb58f7117147e0211ecbfd21c88e2972d8c3566a7f1c7f438abc6311927efbea4cf8a5095e169d014dcd14e67328518414c6a
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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
|
data/bin/check-aggregate.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2017-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|