sensu-plugins-edgelab 1.11.0 → 1.11.1
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
- metadata +2 -18
- data/bin/check-rabbitmq-queues-synchronised.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 076e6c8bad29dc55ffbbf4cd72b7710db3bcdd30
|
4
|
+
data.tar.gz: 8ec7646f4e8c12d9ad42a93f92b942bc1666b477
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 224e41e898131c46a28a10630281ffb05cc7ea73725893ab4930c0fc5822ac9fbe288c25e1353c9b81b62767bf0265ca14a53e56ae28ea8281fe7ffa7c565f46
|
7
|
+
data.tar.gz: 9bc8214833cc511c8911fbdc373e80ceb087a61c7f3f0e4b9e923135ed815b3ec9a1e721a17cefd16cd1cec5ea21941610f296704d52030ff2e0866685dcc7e9
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-edgelab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgelab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sensu-plugins-rabbitmq
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 3.5.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 3.5.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: diplomat
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,7 +164,6 @@ executables:
|
|
178
164
|
- check-nomad-leader.rb
|
179
165
|
- metrics-swarm-cluster.rb
|
180
166
|
- check-logstash-pipeline.rb
|
181
|
-
- check-rabbitmq-queues-synchronised.rb
|
182
167
|
- check-nomad-jobs.rb
|
183
168
|
extensions: []
|
184
169
|
extra_rdoc_files: []
|
@@ -188,7 +173,6 @@ files:
|
|
188
173
|
- bin/check-logstash-pipeline.rb
|
189
174
|
- bin/check-nomad-jobs.rb
|
190
175
|
- bin/check-nomad-leader.rb
|
191
|
-
- bin/check-rabbitmq-queues-synchronised.rb
|
192
176
|
- bin/check-swarm-cluster.rb
|
193
177
|
- bin/metrics-aws-asg.rb
|
194
178
|
- bin/metrics-aws-elb.rb
|
@@ -1,75 +0,0 @@
|
|
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
|
-
@crit = []
|
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 unless nb_slaves != 0
|
44
|
-
unsynchronised = nb_slaves - q['synchronised_slave_nodes'].count
|
45
|
-
if unsynchronised != 0
|
46
|
-
@crit << "#{q['name']}: #{unsynchronised} unsynchronised slave(s)"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
if @crit.empty?
|
50
|
-
ok
|
51
|
-
elsif config[:list_queues]
|
52
|
-
critical 'critical:' + @crit.join(' - ')
|
53
|
-
else
|
54
|
-
critical "critical: #{@crit.count} unsynchronised queues"
|
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
|