sensu-plugins-rabbitmq 3.5.0 → 3.6.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: 1c69134806cf9022b7ae98acf067df1af22ff36d
4
- data.tar.gz: 99201bec94d8734fb4eeaf26e708d7d99c465036
3
+ metadata.gz: 37b8d41fe46ac07ede1456194b6b1953924a12a8
4
+ data.tar.gz: 106179e22f2ec92593d20b62c0eb2c7b6a9abfdc
5
5
  SHA512:
6
- metadata.gz: 0ac52d4769ba910b1f3c491fc41af7645b8257ecedb438c647a4b2889c011764cbe283ced41f0b86645e633191d5dad6ce35c1e5279de8731d8abed4fd6a8bb6
7
- data.tar.gz: c5c23a7709b88182e8e4100685cc607cf45e1575e03db7fe1c22347fb05d071db81eb64720a463355644246c08f3eccaa3f145707243b7a9523c7ffe67f72712
6
+ metadata.gz: 521ec362117fcadb6c0bb993d3041180cde0c5ca40db1a44b8bb687e1d383cc2658467c98d8e70168578c24969522eb9b00f3d7313900a8f59f6040b40657e95
7
+ data.tar.gz: dc16d15e7271d4a973f003143f3a3b4d165aebcbe0504e4c257fad7baa53882a4c287ea2c9fdd879190b26cd1e88fbc078cd3b5d9a6621aa38a095a9ced33942
data/CHANGELOG.md CHANGED
@@ -1,10 +1,17 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [3.6.0] - 2017-10-04
9
+ ### Added
10
+ - check-rabbitmq-queues-synchronised.rb: added new check if all mirrored queues are synchronised (@cyrilgdn)
11
+
12
+ ### Changed
13
+ - updated CHANGELOG guidelines location (@majormoses)
14
+
8
15
  ## [3.5.0] - 2017-09-05
9
16
  ### Changed
10
17
  - RabbitMQ module with common code (@rthouvenin)
@@ -163,7 +170,8 @@ NOTE: this release changes the option flags in check-rabbitmq-node-health.rb to
163
170
  - Remove copy paste errors in the Readme
164
171
  - Removed Rubygems require Ruby 1.8.7 backwards compatibility from all plugins
165
172
 
166
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/3.5.0...HEAD
173
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/3.6.0...HEAD
174
+ [3.6.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/3.5.0...3.6.0
167
175
  [3.5.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/3.4.0...3.5.0
168
176
  [3.4.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/3.3.0...3.4.0
169
177
  [3.3.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/3.2.0...3.3.0
data/README.md CHANGED
@@ -19,6 +19,7 @@
19
19
  * bin/check-rabbitmq-node-usage.rb
20
20
  * bin/check-rabbitmq-queue-drain-time.rb
21
21
  * bin/check-rabbitmq-queue.rb
22
+ * bin/check-rabbitmq-queues-synchronised.rb
22
23
  * bin/check-rabbitmq-stomp-alive.rb
23
24
  * bin/metrics-rabbitmq-overview.rb
24
25
  * bin/metrics-rabbitmq-queue.rb
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+ #
4
+ # Check RabbitMQ Queues Synchronised
5
+ # ===
6
+ #
7
+ # DESCRIPTION:
8
+ # This plugin checks that all mirrored queues which have slaves are synchronised.
9
+ #
10
+ # PLATFORMS:
11
+ # Linux, BSD, Solaris
12
+ #
13
+ # DEPENDENCIES:
14
+ # gem: sensu-plugin
15
+ # gem: rest-client
16
+ #
17
+ # LICENSE:
18
+ # Copyright 2017 Cyril Gaudin <cyril.gaudin@gmail.com>
19
+ #
20
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
21
+ # for details.
22
+
23
+ require 'rest_client'
24
+ require 'sensu-plugins-rabbitmq'
25
+
26
+ # main plugin class
27
+ class CheckRabbitMQQueuesSynchronised < Sensu::Plugin::RabbitMQ::Check
28
+ option :list_queues,
29
+ description: 'If set, will ouput the list of all unsynchronised queues, otherwise only the count',
30
+ long: '--list-queues',
31
+ boolean: true,
32
+ default: false
33
+
34
+ def run
35
+ @crits = []
36
+
37
+ queues = get_queues config
38
+
39
+ queues.each do |q|
40
+ next unless q.key?('slave_nodes')
41
+
42
+ nb_slaves = q['slave_nodes'].count
43
+ next if nb_slaves.zero?
44
+ unsynchronised = nb_slaves - q['synchronised_slave_nodes'].count
45
+ if unsynchronised != 0
46
+ @crits << "#{q['name']}: #{unsynchronised} unsynchronised slave(s)"
47
+ end
48
+ end
49
+ if @crits.empty?
50
+ ok
51
+ elsif config[:list_queues]
52
+ critical @crits.join(' - ')
53
+ else
54
+ critical "#{@crits.count} unsynchronised queue(s)"
55
+ end
56
+ rescue Errno::ECONNREFUSED => e
57
+ critical e.message
58
+ rescue => e
59
+ unknown e.message
60
+ end
61
+
62
+ def get_queues(config)
63
+ url_prefix = config[:ssl] ? 'https' : 'http'
64
+ options = {
65
+ user: config[:username],
66
+ password: config[:password]
67
+ }
68
+
69
+ resource = RestClient::Resource.new(
70
+ "#{url_prefix}://#{config[:host]}:#{config[:port]}/api/queues",
71
+ options
72
+ )
73
+ JSON.parse(resource.get)
74
+ end
75
+ end
@@ -3,7 +3,7 @@
3
3
  module SensuPluginsRabbitMQ
4
4
  module Version
5
5
  MAJOR = 3
6
- MINOR = 5
6
+ MINOR = 6
7
7
  PATCH = 0
8
8
 
9
9
  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: 3.5.0
4
+ version: 3.6.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-06 00:00:00.000000000 Z
11
+ date: 2017-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -265,6 +265,7 @@ executables:
265
265
  - check-rabbitmq-node-usage.rb
266
266
  - check-rabbitmq-queue-drain-time.rb
267
267
  - check-rabbitmq-queue.rb
268
+ - check-rabbitmq-queues-synchronised.rb
268
269
  - check-rabbitmq-stomp-alive.rb
269
270
  - metrics-rabbitmq-exchange.rb
270
271
  - metrics-rabbitmq-overview.rb
@@ -285,6 +286,7 @@ files:
285
286
  - bin/check-rabbitmq-node-usage.rb
286
287
  - bin/check-rabbitmq-queue-drain-time.rb
287
288
  - bin/check-rabbitmq-queue.rb
289
+ - bin/check-rabbitmq-queues-synchronised.rb
288
290
  - bin/check-rabbitmq-stomp-alive.rb
289
291
  - bin/metrics-rabbitmq-exchange.rb
290
292
  - bin/metrics-rabbitmq-overview.rb