bin/check-beanstalk-watchers.rb in sensu-plugins-beanstalk-0.0.3 vs bin/check-beanstalk-watchers.rb in sensu-plugins-beanstalk-0.0.4
- old
+ new
@@ -48,11 +48,11 @@
option :warn,
short: '-w WARN_THRESHOLD',
proc: proc(&:to_i),
default: false
- def run # rubocop:disable all
+ def run
unknown 'Tube was not set' unless config[:tube]
begin
beanstalk = Beanstalk::Connection.new(
"#{config[:host]}:#{config[:port]}"
)
@@ -64,11 +64,10 @@
stats = beanstalk.stats_tube(config[:tube])
watchers = stats['current-watching'].to_i
rescue Beanstalk::NotFoundError
warning "Tube #{config[:tube]} not found"
end
- # #YELLOW
- unless watchers # rubocop:disable IfUnlessModifier
+ unless watchers
watchers = 0
end
if config[:crit] && watchers < config[:crit]
critical "Required at least #{config[:crit]} watchers but have #{watchers}"
elsif config[:warn] && watchers < config[:warn]