Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2008 22:22
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wmoxam/36116 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'beanstalk-client'
if ARGV.length > 0 && ARGV[0] == 'config'
puts "graph_title Beanstalk Queue Size"
puts "graph_vlabel watching"
puts "watching.label Watching"
puts "graph_vlabel reserved"
puts "reserved.label Reserved"
puts "graph_vlabel ready"
puts "ready.label Ready"
puts "graph_vlabel using"
puts "using.label Using"
puts "graph_vlabel buried"
puts "buried.label Buried"
puts "graph_vlabel waiting"
puts "waiting.label Waiting"
puts "graph_vlabel delayed"
puts "delayed.label Delayed"
puts "graph_vlabel urgent"
puts "urgent.label Urgent"
B = 'localhost:11300'
tubes = B.list_tubes
stats = {'current-watching' => 0, 'current-jobs-reserved' => 0, 'current-jobs-ready' => 0,
'current-using' => 0, 'current-jobs-buried' => 0, 'current-waiting' => 0,
'current-jobs-delayed' => 0, 'current-jobs-urgent' => 0 }
tubes.each do |tube|
ts = B.stats_tube(tube)
ts.keys.sort.each do |key|
next unless stats.has_key?(key)
stats[key] += ts[key]
stats.keys.each_pair do |name, value|
p "#{name.split('-').last}.value #{value}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment