Skip to content

Instantly share code, notes, and snippets.

@beanieboi
Forked from bitbckt/resque.rb
Created September 22, 2011 13:42
Show Gist options
  • Save beanieboi/1234796 to your computer and use it in GitHub Desktop.
Save beanieboi/1234796 to your computer and use it in GitHub Desktop.
munin plugin for resque
#!/usr/bin/env ruby
require 'rubygems'
require 'resque'
HOST = ENV['host'] ? ENV['host'] : '127.0.0.1'
PORT = ENV['port'] ? ENV['port'] : '6379'
Resque.redis = "#{HOST}:#{PORT}"
queues = {}
(['failed'] + Resque.queues).each do |queue|
queues[queue] = Resque.size(queue)
end
if ARGV.any? && ARGV[0] == 'config'
puts 'graph_title Queues'
puts 'graph_vlabel Enqueued Jobs'
puts 'graph_category resque'
queues.keys.each do |queue|
puts "#{queue}.label #{queue}"
end
exit 0
end
queues.each do |queue, depth|
puts "#{queue}.value #{depth}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment