sensu-plugins-beanstalk 1.1.0 → 1.2.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 +6 -0
- data/bin/check-beanstalkd.rb +43 -14
- data/lib/sensu-plugins-beanstalk/version.rb +1 -1
- metadata +62 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54f73f6a0282dfe33562f5eceedeafa7e8431a62
|
4
|
+
data.tar.gz: 7c4aaf8616caad47fb7b314e5b0a014a4afc576f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad7244f2cd7b08d82e41f0d0ab0e82590591697487df932479c667fff42f382708fde3b8faae3a2fbb0e33e48b45878b35ff0b5db532bd7ab22734d8615743d4
|
7
|
+
data.tar.gz: 4c9f287845e72f29adc1a2e1288af793aec2eb583a1e4cba2fb2259a5dbcf4d00b6c3bdd0f3758376a0925c76ab11df6cf47fb3b459385579eb0f0a6c20fc2c1
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,11 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.2.0] - 2017-10-22
|
9
|
+
### Added
|
10
|
+
- real tests with serverspec (@anakinj)
|
11
|
+
- check-beanstalkd, ignore missing queues by default. Behavior controlled by --alert-on-missing parameter. (@anakinj)
|
12
|
+
|
8
13
|
## [1.1.0] - 2017-08-15
|
9
14
|
### Added
|
10
15
|
- Option to get the age of a item in the tubes. add age to the --stats (@derkgort)
|
@@ -38,6 +43,7 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
38
43
|
- initial release
|
39
44
|
|
40
45
|
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-beanstalk/compare/1.1.0...HEAD
|
46
|
+
[1.2.0]: https://github.com/sensu-plugins/sensu-plugins-beanstalk/compare/1.1.0...1.2.0
|
41
47
|
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-beanstalk/compare/1.0.0...1.1.0
|
42
48
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-beanstalk/compare/0.0.4...1.0.0
|
43
49
|
[0.0.4]: https://github.com/sensu-plugins/sensu-plugins-beanstalk/compare/0.0.3...0.0.4
|
data/bin/check-beanstalkd.rb
CHANGED
@@ -54,6 +54,14 @@ class BeanstalkdQueuesStatus < Sensu::Plugin::Check::CLI
|
|
54
54
|
long: '--port PORT',
|
55
55
|
default: '11300'
|
56
56
|
|
57
|
+
option :alert_on_missing,
|
58
|
+
description: 'alert type when tube is missing',
|
59
|
+
short: '-a TYPE',
|
60
|
+
long: '--alert-on-missing TYPE',
|
61
|
+
proc: proc { |value| value.to_sym },
|
62
|
+
in: [:critical, :warning, :ignore],
|
63
|
+
default: :ignore
|
64
|
+
|
57
65
|
option :ready,
|
58
66
|
description: 'ready tasks WARNING/CRITICAL thresholds',
|
59
67
|
short: '-r W,C',
|
@@ -85,44 +93,65 @@ class BeanstalkdQueuesStatus < Sensu::Plugin::Check::CLI
|
|
85
93
|
end
|
86
94
|
|
87
95
|
def run
|
88
|
-
|
96
|
+
warns, crits, msg = check_queues(tube_stats)
|
89
97
|
message 'All queues are healthy'
|
90
98
|
|
91
|
-
|
92
|
-
msg.join("\n")
|
93
|
-
|
94
|
-
if crits.size > 0 # rubocop:disable Style/ZeroLengthPredicate
|
99
|
+
unless crits.empty?
|
95
100
|
message msg
|
96
101
|
critical
|
97
102
|
end
|
98
103
|
|
99
|
-
|
104
|
+
unless warns.empty?
|
100
105
|
message msg
|
101
106
|
warning
|
102
107
|
end
|
108
|
+
|
103
109
|
ok
|
104
110
|
end
|
105
111
|
|
112
|
+
JOB_STATES = [:ready, :urgent, :buried].freeze
|
113
|
+
|
106
114
|
def check_queues(stats)
|
107
115
|
msg = []
|
108
116
|
crits = {}
|
109
117
|
warns = {}
|
110
118
|
|
111
|
-
|
112
|
-
|
119
|
+
JOB_STATES.each do |job_state|
|
120
|
+
jobs = stats.send("current_jobs_#{job_state}".to_sym)
|
113
121
|
|
114
|
-
if
|
115
|
-
crits[
|
116
|
-
msg <<
|
122
|
+
if jobs > config[job_state][1]
|
123
|
+
crits[job_state] = jobs
|
124
|
+
msg << job_state.to_s + " queue has #{jobs} items"
|
117
125
|
next
|
118
126
|
end
|
119
127
|
|
120
|
-
if
|
121
|
-
warns[
|
122
|
-
msg <<
|
128
|
+
if jobs > config[job_state][0]
|
129
|
+
warns[job_state] = jobs
|
130
|
+
msg << job_state.to_s + " queue has #{jobs} items"
|
123
131
|
end
|
124
132
|
end
|
125
133
|
|
126
134
|
[warns, crits, msg]
|
127
135
|
end
|
136
|
+
|
137
|
+
def tube_stats
|
138
|
+
acquire_beanstalkd_connection.tubes[config[:tube].to_s].stats
|
139
|
+
rescue Beaneater::NotFoundError
|
140
|
+
case config[:alert_on_missing]
|
141
|
+
when :warning, :critical
|
142
|
+
send(config[:alert_on_missing], "Tube #{config[:tube]} is missing")
|
143
|
+
else
|
144
|
+
empty_queue_stats
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def empty_queue_stats
|
149
|
+
stats = OpenStruct.new
|
150
|
+
|
151
|
+
JOB_STATES.each do |job_state|
|
152
|
+
stats.send("current_jobs_#{job_state}=", 0)
|
153
|
+
end
|
154
|
+
|
155
|
+
stats
|
156
|
+
end
|
128
157
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-beanstalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.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: 2017-
|
11
|
+
date: 2017-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -178,16 +178,72 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0.8'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: serverspec
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 2.36.1
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 2.36.1
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: test-kitchen
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '1.6'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '1.6'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: kitchen-docker
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '2.6'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '2.6'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: kitchen-localhost
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - "~>"
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0.3'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0.3'
|
181
237
|
description: Sensu plugins for beanstalk
|
182
238
|
email: "<sensu-users@googlegroups.com>"
|
183
239
|
executables:
|
184
|
-
- check-beanstalk-jobs.rb
|
185
|
-
- check-beanstalk-statistic.rb
|
186
240
|
- check-beanstalk-watchers-to-buried.rb
|
241
|
+
- check-beanstalk-jobs.rb
|
187
242
|
- check-beanstalk-watchers.rb
|
243
|
+
- check-beanstalk-statistic.rb
|
188
244
|
- check-beanstalkd.rb
|
189
|
-
- metrics-beanstalkd-tubes.rb
|
190
245
|
- metrics-beanstalkd.rb
|
246
|
+
- metrics-beanstalkd-tubes.rb
|
191
247
|
extensions: []
|
192
248
|
extra_rdoc_files: []
|
193
249
|
files:
|
@@ -229,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
285
|
version: '0'
|
230
286
|
requirements: []
|
231
287
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
288
|
+
rubygems_version: 2.6.14
|
233
289
|
signing_key:
|
234
290
|
specification_version: 4
|
235
291
|
summary: Sensu plugins for beanstalk
|