sensu-plugins-rabbitmq 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/bin/check-rabbitmq-node-health.rb +4 -1
- data/bin/check-rabbitmq-queue.rb +26 -6
- data/lib/sensu-plugins-rabbitmq/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 116dbb6b62aa64caac312e1343b5a936359bdee6
|
4
|
+
data.tar.gz: 498801298df6a8841e34dc46e09c95d0f01d387a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d03370a0f1f389a551464da5e18c4d5bbb7581a6ef5710787e930dda4a045e0870daf24de019487fa4bc503c0b7a99c06f98eda12741eb1acd54002410bb805a
|
7
|
+
data.tar.gz: abe18f42bd43c449f4cd330ae47ae4496eb9e64d7e34e476c76180c0163ca7706a6019e471a70db8c42a073dd67a2d221d0c6f25fc1bfc3dc694c21fcf9a8b24
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.1.0] - 2017-01-10
|
9
|
+
### Added
|
10
|
+
- check-rabbitmq-queue.rb: Added features for using regex in queue name and pretty output (@alexpekurovsky)
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- check-rabbitmq-node-health: prevent fd check failing on OSX due to non-numeric fd_used (@thisisjaid)
|
14
|
+
|
8
15
|
## [2.0.0] - 2016-10-17
|
9
16
|
### Added
|
10
17
|
- check-rabbitmq-queue-drain.rb: Added a default include-all value for the regex queue filter option
|
@@ -100,7 +107,8 @@ NOTE: this release changes the option flags in check-rabbitmq-node-health.rb to
|
|
100
107
|
- Remove copy paste errors in the Readme
|
101
108
|
- Removed Rubygems require Ruby 1.8.7 backwards compatibility from all plugins
|
102
109
|
|
103
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.
|
110
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.1.0...HEAD
|
111
|
+
[2.1.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.0.0...2.1.0
|
104
112
|
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/1.3.0...2.0.0
|
105
113
|
[1.3.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/1.2.0...1.3.0
|
106
114
|
[1.2.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/1.1.0...1.2.0
|
@@ -153,7 +153,10 @@ class CheckRabbitMQNodeHealth < Sensu::Plugin::Check::CLI
|
|
153
153
|
# Determine % sockets consumed
|
154
154
|
psocket = format('%.2f', nodeinfo['sockets_used'].fdiv(nodeinfo['sockets_total']) * 100)
|
155
155
|
# Determine % file descriptors consumed
|
156
|
-
|
156
|
+
# Non-numeric value fails silently to handle fd_used = 'unknown' on OSX
|
157
|
+
if nodeinfo['fd_used'].is_a?(Numeric)
|
158
|
+
pfd = format('%.2f', nodeinfo['fd_used'].fdiv(nodeinfo['fd_total']) * 100)
|
159
|
+
end
|
157
160
|
|
158
161
|
# build status and message
|
159
162
|
status = 'ok'
|
data/bin/check-rabbitmq-queue.rb
CHANGED
@@ -84,6 +84,18 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
84
84
|
boolean: true,
|
85
85
|
default: false
|
86
86
|
|
87
|
+
option :regex,
|
88
|
+
description: 'Use queue name as regex pattern',
|
89
|
+
long: '--regex',
|
90
|
+
boolean: true,
|
91
|
+
default: false
|
92
|
+
|
93
|
+
option :pretty,
|
94
|
+
description: 'Prints multiline message',
|
95
|
+
long: '--pretty',
|
96
|
+
boolean: true,
|
97
|
+
default: false
|
98
|
+
|
87
99
|
def acquire_rabbitmq_info
|
88
100
|
begin
|
89
101
|
rabbitmq_info = CarrotTop.new(
|
@@ -105,27 +117,35 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
|
|
105
117
|
rabbitmq = acquire_rabbitmq_info
|
106
118
|
queues = rabbitmq.method_missing('/queues/' + config[:vhost])
|
107
119
|
config[:queue].each do |q|
|
108
|
-
unless queues.map
|
120
|
+
unless (queues.map { |hash| hash['name'] }.include?(q) && config[:regex] == false) || config[:regex] == true
|
109
121
|
unless config[:ignore]
|
110
122
|
@warn << "Queue #{q} not available"
|
111
123
|
end
|
112
124
|
next
|
113
125
|
end
|
114
126
|
queues.each do |queue|
|
115
|
-
next unless queue['name'] == q
|
127
|
+
next unless (queue['name'] == q && config[:regex] == false) || (queue['name'] =~ /#{q}/ && config[:regex] == true)
|
116
128
|
total = queue['messages']
|
117
129
|
total = 0 if total.nil?
|
118
130
|
message total.to_s
|
119
|
-
@crit << "#{
|
120
|
-
@warn << "#{
|
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
|
121
133
|
end
|
122
134
|
end
|
123
135
|
if @crit.empty? && @warn.empty?
|
124
136
|
ok
|
125
137
|
elsif !@crit.empty?
|
126
|
-
|
138
|
+
@message_output = "\n" + 'critical:' + "\n" + @crit.join("\n") if config[:pretty]
|
139
|
+
@message_output = "critical: #{@crit}" unless config[:pretty]
|
140
|
+
unless @warn.empty?
|
141
|
+
@message_output += "\n" + 'warning:' + "\n" + @warn.join("\n") if config[:pretty]
|
142
|
+
@message_output += " warning: #{@warn}" unless config[:pretty]
|
143
|
+
end
|
144
|
+
critical @message_output
|
127
145
|
elsif !@warn.empty?
|
128
|
-
|
146
|
+
@message_output = "\n" + 'warning:' + "\n" + @warn.join("\n") if config[:pretty]
|
147
|
+
@message_output = "warning: #{@warn}" unless config[:pretty]
|
148
|
+
warning @message_output
|
129
149
|
end
|
130
150
|
end
|
131
151
|
end
|
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.
|
4
|
+
version: 2.1.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:
|
11
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -285,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
version: '0'
|
286
286
|
requirements: []
|
287
287
|
rubyforge_project:
|
288
|
-
rubygems_version: 2.5
|
288
|
+
rubygems_version: 2.4.5
|
289
289
|
signing_key:
|
290
290
|
specification_version: 4
|
291
291
|
summary: Sensu plugins for rabbitmq
|