sensu-plugins-sensu 1.1.1 → 2.0.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 +11 -0
- data/bin/check-aggregate.rb +44 -29
- data/lib/sensu-plugins-sensu/version.rb +3 -3
- 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: 2870929cd3cd4f899088cb6ec55104e76807d063
|
4
|
+
data.tar.gz: 3e346d7facc6bf08e84d1993a40e1d4e1345faad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a90af312010e2d9ba78c824d54c64f3fd50918d1d647a1601cd221b31b2cd92e6a5448271df7ab57503048316e1ff1cd5365a1fb8555d93abf5aca56b2ec649e
|
7
|
+
data.tar.gz: 40800095ddbdcd9559a2b8411094a841f4295884bec1ea137ec6bde7d4ce77f7753d7511c1f297f475448c50b9c9653024bbe11d899447b40e36af6306f7a4e5
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,16 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.0.0] - 2017-08-20
|
9
|
+
### Breaking Changes
|
10
|
+
- check-aggregates.rb: Changed the default behaviour to alert with the severity of the aggregated checks.
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- check-aggregates.rb: Added new flag to ignore severities. If --ignore-severity is supplied all non-ok will count for critical, critical_count, warning and warning_count option.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- handler-sensu-deregister.rb: Fix undefined variable in case of API error.
|
17
|
+
|
8
18
|
## [1.1.1] - 2017-08-01
|
9
19
|
### Added
|
10
20
|
- Ruby 2.4 testing (@Evesy)
|
@@ -55,6 +65,7 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
55
65
|
- initial release
|
56
66
|
|
57
67
|
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/1.1.1...HEAD
|
68
|
+
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/1.1.1...2.0.0
|
58
69
|
[1.1.1]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/1.1.0...1.1.1
|
59
70
|
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/1.0.0...1.1.0
|
60
71
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/0.1.0...1.0.0
|
data/bin/check-aggregate.rb
CHANGED
@@ -88,23 +88,23 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
|
|
88
88
|
option :warning,
|
89
89
|
short: '-W PERCENT',
|
90
90
|
long: '--warning PERCENT',
|
91
|
-
description: 'PERCENT
|
91
|
+
description: 'PERCENT warning before warning (can be change with --ignore-severity)',
|
92
92
|
proc: proc(&:to_i)
|
93
93
|
|
94
94
|
option :warning_count,
|
95
95
|
long: '--warning_count INTEGER',
|
96
|
-
description: 'number of nodes in warning before warning',
|
96
|
+
description: 'number of nodes in warning before warning (can be change with --ignore-severity)',
|
97
97
|
proc: proc(&:to_i)
|
98
98
|
|
99
99
|
option :critical,
|
100
100
|
short: '-C PERCENT',
|
101
101
|
long: '--critical PERCENT',
|
102
|
-
description: 'PERCENT
|
102
|
+
description: 'PERCENT critical before critical (can be change with --ignore-severity)',
|
103
103
|
proc: proc(&:to_i)
|
104
104
|
|
105
105
|
option :critical_count,
|
106
106
|
long: '--critical_count INTEGER',
|
107
|
-
description: 'number of node in critical before critical',
|
107
|
+
description: 'number of node in critical before critical (can be change with --ignore-severity)',
|
108
108
|
proc: proc(&:to_i)
|
109
109
|
|
110
110
|
option :pattern,
|
@@ -124,6 +124,12 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
|
|
124
124
|
long: '--message MESSAGE',
|
125
125
|
description: 'A custom error MESSAGE'
|
126
126
|
|
127
|
+
option :ignore_severity,
|
128
|
+
long: '--ignore-severity',
|
129
|
+
description: 'Ignore severities, all non-ok will count for critical, critical_count, warning and warning_count option',
|
130
|
+
boolean: true,
|
131
|
+
default: false
|
132
|
+
|
127
133
|
def api_request(resource)
|
128
134
|
verify_mode = OpenSSL::SSL::VERIFY_PEER
|
129
135
|
verify_mode = OpenSSL::SSL::VERIFY_NONE if config[:insecure]
|
@@ -209,21 +215,25 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
|
|
209
215
|
end
|
210
216
|
|
211
217
|
def compare_thresholds(aggregate)
|
212
|
-
|
213
|
-
message
|
214
|
-
if aggregate[:outputs]
|
215
|
-
|
216
|
-
|
218
|
+
message = config[:message] || 'Number of non-zero results exceeds threshold'
|
219
|
+
message += ' (%d%% %s)'
|
220
|
+
message += "\n" + aggregate[:outputs] if aggregate[:outputs]
|
221
|
+
|
222
|
+
if config[:ignore_severity]
|
223
|
+
percent_non_zero = (100 - (aggregate[:ok].to_f / aggregate[:total].to_f) * 100).to_i
|
224
|
+
if config[:critical] && percent_non_zero >= config[:critical]
|
225
|
+
critical format(message, percent_non_zero, 'non-zero')
|
226
|
+
elsif config[:warning] && percent_non_zero >= config[:warning]
|
227
|
+
warning format(message, percent_non_zero, 'non-zero')
|
217
228
|
end
|
218
229
|
else
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
warning message
|
230
|
+
percent_warning = (aggregate[:warning].to_f / aggregate[:total].to_f * 100).to_i
|
231
|
+
percent_critical = (aggregate[:critical].to_f / aggregate[:total].to_f * 100).to_i
|
232
|
+
if config[:critical] && percent_critical >= config[:critical]
|
233
|
+
critical format(message, percent_critical, 'critical')
|
234
|
+
elsif config[:warning] && percent_warning >= config[:warning]
|
235
|
+
warning format(message, percent_warning, 'warning')
|
236
|
+
end
|
227
237
|
end
|
228
238
|
end
|
229
239
|
|
@@ -247,21 +257,26 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
|
|
247
257
|
end
|
248
258
|
|
249
259
|
def compare_thresholds_count(aggregate)
|
250
|
-
|
251
|
-
message
|
252
|
-
if aggregate[:outputs]
|
253
|
-
|
254
|
-
|
260
|
+
message = config[:message] || 'Number of nodes down exceeds threshold'
|
261
|
+
message += " (%s out of #{aggregate[:total]} nodes reporting %s)"
|
262
|
+
message += "\n" + aggregate[:outputs] if aggregate[:outputs]
|
263
|
+
|
264
|
+
if config[:ignore_severity]
|
265
|
+
number_of_nodes_reporting_down = aggregate[:total].to_i - aggregate[:ok].to_i
|
266
|
+
if config[:critical_count] && number_of_nodes_reporting_down >= config[:critical_count]
|
267
|
+
critical format(message, number_of_nodes_reporting_down, 'not ok')
|
268
|
+
elsif config[:warning_count] && number_of_nodes_reporting_down >= config[:warning_count]
|
269
|
+
warning format(message, number_of_nodes_reporting_down, 'not ok')
|
255
270
|
end
|
256
271
|
else
|
257
|
-
|
258
|
-
|
259
|
-
end
|
272
|
+
nodes_reporting_warning = aggregate[:warning].to_i
|
273
|
+
nodes_reporting_critical = aggregate[:critical].to_i
|
260
274
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
275
|
+
if config[:critical_count] && nodes_reporting_critical >= config[:critical_count]
|
276
|
+
critical format(message, nodes_reporting_critical, 'critical')
|
277
|
+
elsif config[:warning_count] && nodes_reporting_warning >= config[:warning_count]
|
278
|
+
warning format(message, nodes_reporting_warning, 'warning')
|
279
|
+
end
|
265
280
|
end
|
266
281
|
end
|
267
282
|
|
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:
|
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-08-
|
11
|
+
date: 2017-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|