Skip to content

Instantly share code, notes, and snippets.

@beanieboi
Forked from bitbckt/resque.rb
Created November 2, 2011 18:38
Show Gist options
  • Save beanieboi/1334470 to your computer and use it in GitHub Desktop.
Save beanieboi/1334470 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] = queue=='failed' ? Resque::Failure.count : 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
@beanieboi
Copy link
Author

added "failed" queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment