Skip to content

Instantly share code, notes, and snippets.

Forked from wmoxam/gist:36116
Created August 18, 2009 18:45
  • Star 2 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
What would you like to do?
Munin plugin for beanstalk queue
# MODIFIED: Minor fork to run smoothly under Ruby 1.8.6. Heredoc cleanup.
require 'rubygems'
require 'beanstalk-client'
if ARGV.length > 0 && ARGV[0] == 'config'
puts <<-END
graph_category App
graph_title Beanstalk Queue Size
graph_vlabel watching
watching.label Watching
graph_vlabel reserved
reserved.label Reserved
graph_vlabel ready
ready.label Ready
graph_vlabel using
using.label Using
graph_vlabel buried
buried.label Buried
graph_vlabel waiting
waiting.label Waiting
graph_vlabel delayed
delayed.label Delayed
graph_vlabel urgent
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.each do |name, value|
puts "#{name.split('-').last}.value #{value}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment