Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 25 lines (23 sloc) 0.638 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/shared')
THRESHOLD = config(:threshold)
FROM = config(:from)
TO = config(:to)
SUBJECT = config(:subject)

warnings = []
`rabbitmqctl list_queues -q name messages`.split("\n").each do |line|
name, messages = line.split(/[ \t]+/)
messages = messages.to_i
if messages > THRESHOLD
warnings << "Queue '#{name}' has more than #{THRESHOLD} messages: #{messages}"
end
end

if !warnings.empty?
IO.popen("sendmail -t", "w") do |f|
f.puts "To: #{TO}"
f.puts "From: #{FROM}"
f.puts "Subject: #{SUBJECT}"
f.puts
f.puts warnings.join("\n")
end
end
Something went wrong with that request. Please try again.