sensu-plugins-amqp-checks 0.0.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 +7 -0
- data/CHANGELOG.md +12 -0
- data/LICENSE +22 -0
- data/README.md +22 -0
- data/bin/check-amqp-status.rb +95 -0
- data/lib/sensu-plugins-amqp-checks.rb +1 -0
- data/lib/sensu-plugins-amqp-checks/version.rb +9 -0
- metadata +241 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2dc4c36eec9da787b8fa4ec7beae80dcb12c5e2f
|
4
|
+
data.tar.gz: c0a72409c9677b839a71d81253969674ed99510b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f89dacae55528b4e2f44d42dc2f48b2e76be1e788cecd28f9c6d1643ef4f054a17b39f5572115aad3a0911055ef6da8dee5633b2d524cfdc395b85ccb1c0984e
|
7
|
+
data.tar.gz: 7b0c11fce3bb29d12d559a8a56721914eefcab220d9c4f46e47e9d6799b53d4e99b1c5456497a12bc5b2af3ed8e75f7f15f34576fd4e3e0661efdc36eff404f5
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#Change Log
|
2
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
3
|
+
|
4
|
+
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
|
+
|
6
|
+
## [Unreleased]
|
7
|
+
|
8
|
+
## 0.0.1 - 2016-11-18
|
9
|
+
### Added
|
10
|
+
- Add the ability to check a RabbitMQ queue for a status/keepalive message
|
11
|
+
|
12
|
+
[Unreleased]: https://github.com/sbrimhall/sensu-plugins-amqp-checks/compare/0.1.0...HEAD
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Sensu-Plugins
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
## Sensu-Plugins-amqp-checks
|
2
|
+
|
3
|
+
[](https://travis-ci.org/sbrimhall/sensu-plugins-amqp-checks)
|
4
|
+
[](http://badge.fury.io/rb/sensu-plugins-amqp-checks)
|
5
|
+
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-amqp-checks)
|
6
|
+
[](https://codeclimate.com/github/sbrimhall/sensu-plugins-amqp-checks)
|
7
|
+
[](https://gemnasium.com/sbrimhall/sensu-plugins-amqp-checks)
|
8
|
+
|
9
|
+
## Functionality
|
10
|
+
|
11
|
+
This plugin is for checking a RabbitMQ queue for a keepalive/status message
|
12
|
+
|
13
|
+
## Files
|
14
|
+
* bin/check-amqp-status.rb
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
21
|
+
|
22
|
+
## Notes
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# Check RabbitMQ Queue Messages
|
5
|
+
# ===
|
6
|
+
#
|
7
|
+
# DESCRIPTION:
|
8
|
+
# This plugin checks the number of messages queued on the RabbitMQ server in a specific queues
|
9
|
+
#
|
10
|
+
# PLATFORMS:
|
11
|
+
# Linux, BSD, Solaris
|
12
|
+
#
|
13
|
+
# DEPENDENCIES:
|
14
|
+
# RabbitMQ rabbitmq_management plugin
|
15
|
+
# gem: sensu-plugin
|
16
|
+
# gem: carrot-top
|
17
|
+
#
|
18
|
+
# LICENSE:
|
19
|
+
# Copyright 2012 Evan Hazlett <ejhazlett@gmail.com>
|
20
|
+
#
|
21
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
22
|
+
# for details.
|
23
|
+
|
24
|
+
require 'sensu-plugin/check/cli'
|
25
|
+
require 'bunny'
|
26
|
+
|
27
|
+
# main plugin class
|
28
|
+
class CheckAMQPStatus < Sensu::Plugin::Check::CLI
|
29
|
+
option :host,
|
30
|
+
description: 'RabbitMQ host',
|
31
|
+
long: '--host HOST',
|
32
|
+
required: true,
|
33
|
+
default: 'localhost'
|
34
|
+
|
35
|
+
option :port,
|
36
|
+
description: 'RabbitMQ management API port',
|
37
|
+
long: '--port PORT',
|
38
|
+
proc: proc(&:to_i),
|
39
|
+
default: 15_672
|
40
|
+
|
41
|
+
option :vhost,
|
42
|
+
description: 'RabbitMQ vhost',
|
43
|
+
short: '-v',
|
44
|
+
long: '--vhost VHOST',
|
45
|
+
default: ''
|
46
|
+
|
47
|
+
option :user,
|
48
|
+
description: 'RabbitMQ management API user',
|
49
|
+
long: '--user USER',
|
50
|
+
default: 'guest'
|
51
|
+
|
52
|
+
option :password,
|
53
|
+
description: 'RabbitMQ management API password',
|
54
|
+
long: '--password PASSWORD',
|
55
|
+
default: 'guest'
|
56
|
+
|
57
|
+
option :queue,
|
58
|
+
description: 'RabbitMQ queue to monitor',
|
59
|
+
long: '--queue queue_names',
|
60
|
+
required: true,
|
61
|
+
proc: proc { |a| a.split(',') }
|
62
|
+
|
63
|
+
def connect
|
64
|
+
conn = Bunny.new("amqp://#{config[:user]}:#{config[:pass]}@#{config[:host]}:#{config[:port]}#{config[:vhost]}")
|
65
|
+
conn.start
|
66
|
+
end
|
67
|
+
|
68
|
+
def run
|
69
|
+
# Connect to RabbitMQ
|
70
|
+
rabbitmq = connect
|
71
|
+
channel = rabbitmq.create_channel
|
72
|
+
q = channel.queue(config[:queue], exclusive: false, durable: true)
|
73
|
+
|
74
|
+
# Check if there are any messages to be consumed
|
75
|
+
count = q.message_count
|
76
|
+
if count == 0
|
77
|
+
critical "critical: No alive message found. #{config[:queue]} queue is empty."
|
78
|
+
end
|
79
|
+
|
80
|
+
# Consume the messages one at a time since this is not meant to be a persistent process
|
81
|
+
until count < 1
|
82
|
+
q.pop(block: true, manual_ack: false) do |_delivery_info, properties, payload|
|
83
|
+
if payload.nil?
|
84
|
+
critical "critical: Payload empty even though there was supposed to be a message. Message properties are #{properties.inspect}"
|
85
|
+
else
|
86
|
+
puts "Received #{payload}, message properties are #{properties.inspect}"
|
87
|
+
end
|
88
|
+
count -= 1
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Assuming we got this far, exit cleanly
|
93
|
+
ok
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'sensu-plugins-amqp-checks/version'
|
metadata
ADDED
@@ -0,0 +1,241 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sensu-plugins-amqp-checks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Brimhall
|
8
|
+
- Sensu-Plugins and contributors
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sensu-plugin
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.2'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.2'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: carrot-top
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.0.7
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.0.7
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bunny
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 2.5.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 2.5.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: amq-protocol
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.0.1
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.0.1
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: bundler
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.7'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.7'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: codeclimate-test-reporter
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.4'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.4'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: github-markup
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.3'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.3'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: pry
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0.10'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.10'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rake
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '10.5'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '10.5'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: redcarpet
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '3.2'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '3.2'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: rubocop
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 0.40.0
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 0.40.0
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: rspec
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - "~>"
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '3.4'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - "~>"
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '3.4'
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: yard
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - "~>"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0.8'
|
189
|
+
type: :development
|
190
|
+
prerelease: false
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - "~>"
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0.8'
|
196
|
+
description: |-
|
197
|
+
This plugin provides checking of a RabbitMQ
|
198
|
+
message queue for alive/status messages.
|
199
|
+
email: "<scottbrimhall@gmail.com>"
|
200
|
+
executables:
|
201
|
+
- check-amqp-status.rb
|
202
|
+
extensions: []
|
203
|
+
extra_rdoc_files: []
|
204
|
+
files:
|
205
|
+
- CHANGELOG.md
|
206
|
+
- LICENSE
|
207
|
+
- README.md
|
208
|
+
- bin/check-amqp-status.rb
|
209
|
+
- lib/sensu-plugins-amqp-checks.rb
|
210
|
+
- lib/sensu-plugins-amqp-checks/version.rb
|
211
|
+
homepage: https://github.com/sbrimhall/sensu-plugins-amqp-checks
|
212
|
+
licenses:
|
213
|
+
- MIT
|
214
|
+
metadata:
|
215
|
+
maintainer: sbrimhall
|
216
|
+
development_status: active
|
217
|
+
production_status: unstable - testing recommended
|
218
|
+
release_draft: 'false'
|
219
|
+
release_prerelease: 'false'
|
220
|
+
post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
|
221
|
+
in /etc/default/sensu
|
222
|
+
rdoc_options: []
|
223
|
+
require_paths:
|
224
|
+
- lib
|
225
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 2.0.0
|
230
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - ">="
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
235
|
+
requirements: []
|
236
|
+
rubyforge_project:
|
237
|
+
rubygems_version: 2.4.5
|
238
|
+
signing_key:
|
239
|
+
specification_version: 4
|
240
|
+
summary: Sensu plugin for checking an amqp/RabbitMQ queue
|
241
|
+
test_files: []
|