sensu-plugins-edgelab 1.9.0 → 1.10.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/bin/check-rabbitmq-queues-synchronised.rb +74 -0
- metadata +31 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fca12baa8b294e41d044c6f44e6cf35b31d11da
|
4
|
+
data.tar.gz: 6c0b5f65a29f91c3235815568f7cea831c6a182d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76ed91f6f03f3dde268642312f0f752ffd9584047a6c1056b3309a264cd4b868b324e2fa41a7fa528fd8d2454f4aa7d4947c2efe766a00e3b9568acd6c3cecc7
|
7
|
+
data.tar.gz: 3f33edb8fb6dbed57f82da40817dfdef67420c66bad530081fa27cb7eb8d19b558ba2c83e9cb6a9214ff26182c0ce94d37def67ad486b17ffa290f1f8a67c379
|
@@ -0,0 +1,74 @@
|
|
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
|
+
nb_slaves = q['slave_nodes'].count
|
41
|
+
unless nb_slaves == 0
|
42
|
+
unsynchronised = nb_slaves - q['synchronised_slave_nodes'].count
|
43
|
+
if unsynchronised != 0
|
44
|
+
@crit << "#{q['name']}: #{unsynchronised} unsynchronised slave(s)"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
if @crit.empty?
|
49
|
+
ok
|
50
|
+
elsif config[:list_queues]
|
51
|
+
critical 'critical:' + @crit.join(' - ')
|
52
|
+
else
|
53
|
+
critical "critical: #{@crit.count} unsynchronised queues"
|
54
|
+
end
|
55
|
+
rescue Errno::ECONNREFUSED => e
|
56
|
+
critical e.message
|
57
|
+
rescue => e
|
58
|
+
unknown e.message
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_queues(config)
|
62
|
+
url_prefix = config[:ssl] ? 'https' : 'http'
|
63
|
+
options = {
|
64
|
+
user: config[:username],
|
65
|
+
password: config[:password]
|
66
|
+
}
|
67
|
+
|
68
|
+
resource = RestClient::Resource.new(
|
69
|
+
"#{url_prefix}://#{config[:host]}:#{config[:port]}/api/queues",
|
70
|
+
options
|
71
|
+
)
|
72
|
+
JSON.parse(resource.get)
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-edgelab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgelab
|
@@ -24,6 +24,20 @@ 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
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: diplomat
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - '='
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: 1.8.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ruby-mysql
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.9'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.9'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: redis
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,6 +176,7 @@ executables:
|
|
148
176
|
- metrics-aws-rds.rb
|
149
177
|
- metrics-aws-asg.rb
|
150
178
|
- check-consul-services.rb
|
179
|
+
- check-rabbitmq-queues-synchronised.rb
|
151
180
|
- check-nomad-leader.rb
|
152
181
|
- check-nomad-jobs.rb
|
153
182
|
extensions: []
|
@@ -157,6 +186,7 @@ files:
|
|
157
186
|
- bin/check-consul-services.rb
|
158
187
|
- bin/check-nomad-jobs.rb
|
159
188
|
- bin/check-nomad-leader.rb
|
189
|
+
- bin/check-rabbitmq-queues-synchronised.rb
|
160
190
|
- bin/check-swarm-cluster.rb
|
161
191
|
- bin/metrics-aws-asg.rb
|
162
192
|
- bin/metrics-aws-elb.rb
|