sensu-plugins-rabbitmq 2.1.0 → 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: 116dbb6b62aa64caac312e1343b5a936359bdee6
4
- data.tar.gz: 498801298df6a8841e34dc46e09c95d0f01d387a
3
+ metadata.gz: ff32df838a2e797f64a61cbe8252c90dbc4c9a0b
4
+ data.tar.gz: 22809d71989e50eec3dd8adbe9250d1bab5d0599
5
5
  SHA512:
6
- metadata.gz: d03370a0f1f389a551464da5e18c4d5bbb7581a6ef5710787e930dda4a045e0870daf24de019487fa4bc503c0b7a99c06f98eda12741eb1acd54002410bb805a
7
- data.tar.gz: abe18f42bd43c449f4cd330ae47ae4496eb9e64d7e34e476c76180c0163ca7706a6019e471a70db8c42a073dd67a2d221d0c6f25fc1bfc3dc694c21fcf9a8b24
6
+ metadata.gz: 6fe85be96dc866d9c236252b3495272173b45818830fc7fd6086e9e7a5ddef51571dcfedd71fe2e92ee439d91a145eed6dedfb73ac281fecd95f59243ed1b3bc
7
+ data.tar.gz: 2ccf9af3dd6ef5095ad8221d15639085c8e7cd59e3c8e6059f8c465dcfffc3f068c31cdd4cde9f711f7b8d10ee22a00294edb9c8e055ba9bb84aace88608197d
data/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+ ### [2.2.0] - 2017-05-08
8
+ ### Added
9
+ - check-rabbitmq-queue.rb: Added --below feature to specify if value below threshold should generate alert (@alexpekurovsky)
10
+
11
+ ### Fixed
12
+ - check-rabbitmq-queue.rb: Fixes for assigning values to critical or warning states (@alexpekurovsky)
13
+ - check-rabbitmq-consumers.rb: Fixes rabbitmq empty value for consumers in some situations (@mdzidic)
14
+ - check-rabbitmq-consumers.rb: Fixes rabbitmq plugin crash when node is in network partition (@mdzidic)
15
+
16
+ ### Changed
17
+ - bump stomp version to 1.4.3
7
18
 
8
19
  ## [2.1.0] - 2017-01-10
9
20
  ### Added
@@ -107,7 +118,8 @@ NOTE: this release changes the option flags in check-rabbitmq-node-health.rb to
107
118
  - Remove copy paste errors in the Readme
108
119
  - Removed Rubygems require Ruby 1.8.7 backwards compatibility from all plugins
109
120
 
110
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.1.0...HEAD
121
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.2.0...HEAD
122
+ [2.2.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.1.0...2.2.0
111
123
  [2.1.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.0.0...2.1.0
112
124
  [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/1.3.0...2.0.0
113
125
  [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/1.2.0...1.3.0
@@ -112,20 +112,23 @@ class CheckRabbitMQConsumers < Sensu::Plugin::Check::CLI
112
112
  critical = []
113
113
  warn = []
114
114
 
115
- rabbit.queues.each do |queue|
116
- # if specific queues were passed only monitor those.
117
- # if specific queues to exclude were passed then skip those
118
- if config[:queue]
119
- next unless config[:queue].include?(queue['name'])
120
- elsif config[:exclude]
121
- next if config[:exclude].include?(queue['name'])
115
+ begin
116
+ rabbit.queues.each do |queue|
117
+ # if specific queues were passed only monitor those.
118
+ # if specific queues to exclude were passed then skip those
119
+ if config[:queue]
120
+ next unless config[:queue].include?(queue['name'])
121
+ elsif config[:exclude]
122
+ next if config[:exclude].include?(queue['name'])
123
+ end
124
+ missing.delete(queue['name'])
125
+ consumers = queue['consumers'] || 0
126
+ critical.push(queue['name']) if consumers <= config[:critical]
127
+ warn.push(queue['name']) if consumers <= config[:warn]
122
128
  end
123
- missing.delete(queue['name'])
124
- consumers = queue['consumers']
125
- critical.push(queue['name']) if consumers <= config[:critical]
126
- warn.push(queue['name']) if consumers <= config[:warn]
129
+ rescue
130
+ critical 'Could not find any queue, check rabbitmq server'
127
131
  end
128
-
129
132
  return_condition(missing, critical, warn)
130
133
  end
131
134
  end
@@ -96,6 +96,12 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
96
96
  boolean: true,
97
97
  default: false
98
98
 
99
+ option :below,
100
+ description: 'If set, values under threshold are counted as warning/critical',
101
+ long: '--below',
102
+ boolean: true,
103
+ default: false
104
+
99
105
  def acquire_rabbitmq_info
100
106
  begin
101
107
  rabbitmq_info = CarrotTop.new(
@@ -115,7 +121,7 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
115
121
  @crit = []
116
122
  @warn = []
117
123
  rabbitmq = acquire_rabbitmq_info
118
- queues = rabbitmq.method_missing('/queues/' + config[:vhost])
124
+ queues = rabbitmq.method_missing('queues/' + config[:vhost])
119
125
  config[:queue].each do |q|
120
126
  unless (queues.map { |hash| hash['name'] }.include?(q) && config[:regex] == false) || config[:regex] == true
121
127
  unless config[:ignore]
@@ -128,10 +134,23 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
128
134
  total = queue['messages']
129
135
  total = 0 if total.nil?
130
136
  message total.to_s
131
- @crit << "#{queue['name']}:#{total}" if total > config[:critical].to_i
132
- @warn << "#{queue['name']}:#{total}" if total > config[:warn].to_i && total < config[:critical].to_i
137
+ assign_alerts(queue['name'], total)
133
138
  end
134
139
  end
140
+ generate_output
141
+ end
142
+
143
+ def assign_alerts(queue_name, total)
144
+ if config[:below]
145
+ @crit << "#{queue_name}:#{total}" if total <= config[:critical].to_i
146
+ @warn << "#{queue_name}:#{total}" if total <= config[:warn].to_i && total > config[:critical].to_i
147
+ else
148
+ @crit << "#{queue_name}:#{total}" if total >= config[:critical].to_i
149
+ @warn << "#{queue_name}:#{total}" if total >= config[:warn].to_i && total < config[:critical].to_i
150
+ end
151
+ end
152
+
153
+ def generate_output
135
154
  if @crit.empty? && @warn.empty?
136
155
  ok
137
156
  elsif !@crit.empty?
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsRabbitMQ
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
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-01-10 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.4
47
+ version: 1.4.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.4
54
+ version: 1.4.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rest-client
57
57
  requirement: !ruby/object:Gem::Requirement