Sha256: 18dcfc79b4bfdc1ccad2051ad45636a035289caa8c008b8399c208b026d0b439
Contents?: true
Size: 1.58 KB
Versions: 3
Compression:
Stored size: 1.58 KB
Contents
#! /usr/bin/env ruby # # beanstalkd-metrics # # DESCRIPTION: # This plugin checks the beanstalkd stats, using the beaneater gem # # OUTPUT: # metric-data # # PLATFORMS: # Linux # # DEPENDENCIES: # gem: beaneater # gem: json # gem: sensu-plugin # # USAGE: # #YELLOW # # NOTES: # # LICENSE: # Copyright 2014 99designs, Inc <devops@99designs.com> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/metric/cli' require 'json' require 'beaneater' # # Checks the queue levels # class BeanstalkdMetrics < Sensu::Plugin::Metric::CLI::Graphite option :server, description: 'beanstalkd server', short: '-s SERVER', long: '--server SERVER', default: 'localhost' option :port, description: 'beanstalkd server port', short: '-p PORT', long: '--port PORT', default: '11300' option :scheme, description: 'Metric naming scheme, text to prepend to metric', short: '-s SCHEME', long: '--scheme SCHEME', default: "#{Socket.gethostname}.beanstalkd" def acquire_beanstalkd_connection begin conn = Beaneater::Pool.new(["#{config[:server]}:#{config[:port]}"]) rescue warning 'could not connect to beanstalkd' end conn end def run stats = acquire_beanstalkd_connection.stats stats.keys.sort.each do |key| next if key == 'version' # The version X.Y.Z is not a number output "#{config[:scheme]}.#{key}", stats.public_send(key) end ok end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-beanstalk-0.0.1 | bin/metrics-beanstalkd.rb |
sensu-plugins-beanstalk-0.0.1.alpha.2 | bin/metrics-beanstalkd.rb |
sensu-plugins-beanstalk-0.0.1.alpha.1 | bin/metrics-beanstalkd.rb |