sensu-plugins-rabbitmq 0.0.4 → 0.1.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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +13 -1
- data/README.md +2 -2
- data/bin/check-rabbitmq-cluster-health.rb +11 -3
- data/bin/check-rabbitmq-messages.rb +10 -3
- data/bin/check-rabbitmq-node-health.rb +9 -1
- data/bin/check-rabbitmq-queue-drain-time.rb +1 -1
- data/bin/check-rabbitmq-queue.rb +20 -6
- data/bin/check-rabbitmq-stomp-alive.rb +4 -4
- data/bin/metrics-rabbitmq-queue.rb +2 -1
- data/lib/sensu-plugins-rabbitmq/version.rb +2 -2
- metadata +9 -5
- metadata.gz.sig +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fee6c8b3220c699cd8a25a9676c69366943abb4d
|
4
|
+
data.tar.gz: 7bc4d69c6d6b22a82246ae61263cb1ea8891127e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13ea436d73f3fdb68befca4cf75b4ccf0d7a759f6027de5d587cb65b878814443d19f208b0d71ee3c610f0b5dcf9019f645a742b5912bedd50c11ce989e9a126
|
7
|
+
data.tar.gz: f3f9f75506bc3eacffd21e1f09e3758c7993236232af5f4a5c388c934064182e06604e5db6d3d98786a38c11326571f00b3a766a084bf274a468927e51960c55
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -5,7 +5,19 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## Unreleased
|
7
7
|
|
8
|
-
## [0.0
|
8
|
+
## [0.1.0] - 2015-11-19
|
9
|
+
### Changed
|
10
|
+
- Upgrade to rubocop 0.32.1 and cleanup
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- check-rabbitmq-queue.rb: Added option to ignore non-existent queues
|
14
|
+
- check-rabbitmq-queue.rb: Added vhost support
|
15
|
+
- Added SSL support to check-rabbitmq-cluster-health.rb and check-rabbitmq-node-health.rb
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- metrics-rabbitmq-queue.rb: Fix error when queue['messages'] is missing
|
19
|
+
|
20
|
+
## [0.0.4] - 2015-08-18
|
9
21
|
### Changed
|
10
22
|
- pinned amq-protocol
|
11
23
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## Sensu-Plugins-rabbitmq
|
2
2
|
|
3
|
-
[
|
3
|
+
[](https://travis-ci.org/sensu-plugins/sensu-plugins-rabbitmq)
|
4
4
|
[](http://badge.fury.io/rb/sensu-plugins-rabbitmq)
|
5
5
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-rabbitmq)
|
6
6
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-rabbitmq)
|
@@ -27,6 +27,6 @@
|
|
27
27
|
|
28
28
|
## Installation
|
29
29
|
|
30
|
-
[Installation and Setup](
|
30
|
+
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
31
31
|
|
32
32
|
## Notes
|
@@ -61,6 +61,12 @@ class CheckRabbitMQCluster < Sensu::Plugin::Check::CLI
|
|
61
61
|
long: '--nodes NODE1,NODE2',
|
62
62
|
default: ''
|
63
63
|
|
64
|
+
option :ssl,
|
65
|
+
description: 'Enable SSL for connection to the API',
|
66
|
+
long: '--ssl',
|
67
|
+
boolean: true,
|
68
|
+
default: false
|
69
|
+
|
64
70
|
def run
|
65
71
|
res = cluster_healthy?
|
66
72
|
|
@@ -93,10 +99,12 @@ class CheckRabbitMQCluster < Sensu::Plugin::Check::CLI
|
|
93
99
|
port = config[:port]
|
94
100
|
username = config[:username]
|
95
101
|
password = config[:password]
|
96
|
-
|
102
|
+
ssl = config[:ssl]
|
103
|
+
nodes = config[:nodes].split(',')
|
97
104
|
|
98
105
|
begin
|
99
|
-
|
106
|
+
ssl ? url_prefix = 'https' : url_prefix = 'http'
|
107
|
+
resource = RestClient::Resource.new "#{url_prefix}://#{host}:#{port}/api/nodes", username, password
|
100
108
|
# create a hash of the server names and their running state
|
101
109
|
servers_status = Hash[JSON.parse(resource.get).map { |server| [server['name'], server['running']] }]
|
102
110
|
|
@@ -113,7 +121,7 @@ class CheckRabbitMQCluster < Sensu::Plugin::Check::CLI
|
|
113
121
|
else
|
114
122
|
message = "#{failed_nodes.count} failed cluster node: #{failed_nodes.sort.join(',')}"
|
115
123
|
end
|
116
|
-
message.prepend("#{missing_nodes.count
|
124
|
+
message.prepend("#{missing_nodes.count} node(s) not found: #{missing_nodes.join(',')}. ") unless missing_nodes.empty?
|
117
125
|
{ 'status' => status, 'message' => message }
|
118
126
|
rescue Errno::ECONNREFUSED => e
|
119
127
|
{ 'status' => 'critical', 'message' => e.message }
|
@@ -80,7 +80,7 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
80
80
|
default: []
|
81
81
|
|
82
82
|
def generate_message(status_hash)
|
83
|
-
message =
|
83
|
+
message = []
|
84
84
|
status_hash.each_pair do |k, v|
|
85
85
|
message << "#{k}: #{v}"
|
86
86
|
end
|
@@ -111,8 +111,15 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
111
111
|
crit_queues = {}
|
112
112
|
rabbitmq.queues.each do |queue|
|
113
113
|
next if config[:excluded].include?(queue['name'])
|
114
|
-
|
115
|
-
|
114
|
+
queue['messages'] ||= 0
|
115
|
+
if queue['messages'] >= config[:critical].to_i
|
116
|
+
crit_queues["#{queue['name']}"] = queue['messages']
|
117
|
+
next
|
118
|
+
end
|
119
|
+
if queue['messages'] >= config[:warn].to_i
|
120
|
+
warn_queues["#{queue['name']}"] = queue['messages']
|
121
|
+
next
|
122
|
+
end
|
116
123
|
end
|
117
124
|
message crit_queues.empty? ? generate_message(warn_queues) : generate_message(crit_queues)
|
118
125
|
critical unless crit_queues.empty?
|
@@ -55,6 +55,12 @@ class CheckRabbitMQNodeHealth < Sensu::Plugin::Check::CLI
|
|
55
55
|
long: '--port PORT',
|
56
56
|
default: '15672'
|
57
57
|
|
58
|
+
option :ssl,
|
59
|
+
description: 'Enable SSL for connection to the API',
|
60
|
+
long: '--ssl',
|
61
|
+
boolean: true,
|
62
|
+
default: false
|
63
|
+
|
58
64
|
option :memwarn,
|
59
65
|
description: 'Warning % of mem usage vs high watermark',
|
60
66
|
short: '-m',
|
@@ -122,9 +128,11 @@ class CheckRabbitMQNodeHealth < Sensu::Plugin::Check::CLI
|
|
122
128
|
port = config[:port]
|
123
129
|
username = config[:username]
|
124
130
|
password = config[:password]
|
131
|
+
ssl = config[:ssl]
|
125
132
|
|
126
133
|
begin
|
127
|
-
|
134
|
+
ssl ? url_prefix = 'https' : url_prefix = 'http'
|
135
|
+
resource = RestClient::Resource.new "#{url_prefix}://#{host}:#{port}/api/nodes", username, password
|
128
136
|
# Parse our json data
|
129
137
|
nodeinfo = JSON.parse(resource.get)[0]
|
130
138
|
|
@@ -103,7 +103,7 @@ class CheckRabbitMQQueueDrainTime < Sensu::Plugin::Check::CLI
|
|
103
103
|
|
104
104
|
# handle rate of zero which is an infinite time until empty
|
105
105
|
if queue['backing_queue_status']['avg_egress_rate'].to_f == 0
|
106
|
-
crit_queues[queue['name']]
|
106
|
+
crit_queues[queue['name']] = 'Infinite (drain rate = 0)'
|
107
107
|
next
|
108
108
|
end
|
109
109
|
|
data/bin/check-rabbitmq-queue.rb
CHANGED
@@ -38,6 +38,12 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
38
38
|
proc: proc(&:to_i),
|
39
39
|
default: 15_672
|
40
40
|
|
41
|
+
option :vhost,
|
42
|
+
description: 'RabbitMQ vhost',
|
43
|
+
short: '-v',
|
44
|
+
long: '--vhost VHOST',
|
45
|
+
default: '%2F'
|
46
|
+
|
41
47
|
option :ssl,
|
42
48
|
description: 'Enable SSL for connection to the API',
|
43
49
|
long: '--ssl',
|
@@ -72,6 +78,12 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
72
78
|
description: 'CRITICAL message count threshold',
|
73
79
|
default: 500
|
74
80
|
|
81
|
+
option :ignore,
|
82
|
+
description: 'Ignore non-existent queues',
|
83
|
+
long: '--ignore',
|
84
|
+
boolean: true,
|
85
|
+
default: false
|
86
|
+
|
75
87
|
def acquire_rabbitmq_info
|
76
88
|
begin
|
77
89
|
rabbitmq_info = CarrotTop.new(
|
@@ -91,10 +103,12 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
91
103
|
@crit = []
|
92
104
|
@warn = []
|
93
105
|
rabbitmq = acquire_rabbitmq_info
|
94
|
-
queues = rabbitmq.queues
|
106
|
+
queues = rabbitmq.method_missing('/queues/' + config[:vhost])
|
95
107
|
config[:queue].each do |q|
|
96
108
|
unless queues.map { |hash| hash['name'] }.include? q
|
97
|
-
|
109
|
+
unless config[:ignore]
|
110
|
+
@warn << "Queue #{q} not available"
|
111
|
+
end
|
98
112
|
next
|
99
113
|
end
|
100
114
|
queues.each do |queue|
|
@@ -102,16 +116,16 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
102
116
|
total = queue['messages']
|
103
117
|
total = 0 if total.nil?
|
104
118
|
message "#{total}"
|
105
|
-
@crit << "#{
|
106
|
-
@warn << "#{
|
119
|
+
@crit << "#{q}:#{total}" if total > config[:critical].to_i
|
120
|
+
@warn << "#{q}:#{total}" if total > config[:warn].to_i
|
107
121
|
end
|
108
122
|
end
|
109
123
|
if @crit.empty? && @warn.empty?
|
110
124
|
ok
|
111
125
|
elsif !(@crit.empty?)
|
112
|
-
critical "critical: #{
|
126
|
+
critical "critical: #{@crit} warning: #{@warn}"
|
113
127
|
elsif !(@warn.empty?)
|
114
|
-
warning "critical: #{
|
128
|
+
warning "critical: #{@crit} warning: #{@warn}"
|
115
129
|
end
|
116
130
|
end
|
117
131
|
end
|
@@ -98,10 +98,10 @@ class CheckRabbitStomp < Sensu::Plugin::Check::CLI
|
|
98
98
|
conn.subscribe("/queue/#{config[:queue]}") do |_msg|
|
99
99
|
end
|
100
100
|
{ 'status' => 'ok', 'message' => 'RabbitMQ server is alive' }
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
101
|
+
rescue Errno::ECONNREFUSED
|
102
|
+
{ 'status' => 'critical', 'message' => 'TCP connection refused' }
|
103
|
+
rescue Stomp::Error::BrokerException => e
|
104
|
+
{ 'status' => 'critical', 'message' => "Error from broker. Check auth details? #{e.message}" }
|
105
105
|
rescue => e
|
106
106
|
{ 'status' => 'unknown', 'message' => "#{e.class}: #{e.message}" }
|
107
107
|
end
|
@@ -91,8 +91,9 @@ class RabbitMQMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# calculate and output time till the queue is drained in drain metrics
|
94
|
+
queue['messages'] ||= 0
|
94
95
|
drain_time = queue['messages'] / queue['backing_queue_status']['avg_egress_rate']
|
95
|
-
drain_time = 0 if drain_time.nan? # 0 rate with 0 messages is 0 time to drain
|
96
|
+
drain_time = 0 if drain_time.nan? || drain_time.infinite? # 0 rate with 0 messages is 0 time to drain
|
96
97
|
output([config[:scheme], queue['name'], 'drain_time'].join('.'), drain_time.to_i, timestamp)
|
97
98
|
|
98
99
|
%w(messages consumers).each do |metric|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-rabbitmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sensu-plugin
|
@@ -136,14 +136,14 @@ dependencies:
|
|
136
136
|
requirements:
|
137
137
|
- - '='
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 0.32.1
|
140
140
|
type: :development
|
141
141
|
prerelease: false
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - '='
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
146
|
+
version: 0.32.1
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: rspec
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,7 +242,11 @@ dependencies:
|
|
242
242
|
- - "~>"
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0.10'
|
245
|
-
description:
|
245
|
+
description: |-
|
246
|
+
This plugin provides native RabbitMQ instrumentation
|
247
|
+
for monitoring and metrics collection, including:
|
248
|
+
service health, message, consumer, and queue health/metrics
|
249
|
+
via `rabbitmq_management`, and more
|
246
250
|
email: "<sensu-users@googlegroups.com>"
|
247
251
|
executables:
|
248
252
|
- metrics-rabbitmq-queue.rb
|
metadata.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
��إ�Fys:�\���@�P@`k����@��aJW�e:`���U��0~��:A��7�i4�'g�^��[o���e�^S�e��-^#ݚR��p����UW�� �w~�ᇄN�g�| ylԊu��{qR/�A����u1 ��N�sIS{����o))����x&��&Cۇ�w'bĈ�0]m��떠{��"wk��Y�Y~t��2S�����]�4\�z=��w� �s*N�L+r��*M� ��FL��b�;q
|