Reputation: 125942
I'm working on a system that uses several RabbitMQ queues. I'd like to know things like "are any queues getting full (not being handled quickly enough)?" and "how full are the queues relative to each other?" A few realtime bar graphs would be sufficient.
How can I see this info? I'm looking at the JSON API, but it's not clear to me which numbers are relevant; eg, for a given queue, the messages
count keeps showing 0, even when messages are flowing through.
Upvotes: 0
Views: 1095
Reputation: 125942
@jhilden's answer got me going; "len" was what I wanted to see. Here's a simple Ruby script to poll and spit out the queue lengths:
require "json"
require "time"
user = "guest"
password = "guest"
host = "localhost"
port = "15672"
vhost = "%2f" # url encoded "/", the default vhost
interval = 2
loop do
# We could do this using native Ruby code instead
command = "curl -u #{user}:#{password} http://#{host}:#{port}/api/queues/#{vhost} 2> /dev/null"
json = %x{#{command}}
data = JSON.parse(json)
info = data.map { |q|
"#{q.fetch("name")} - #{q.fetch("backing_queue_status").fetch("len")}"
}.join("\n")
puts DateTime.now
puts info
puts "=" * 40
sleep interval
end
Upvotes: 2
Reputation: 12429
We created a splunk alert based off of the queue length, I'm guessing you're trying to do something similar.
If you are using the queues JSON API (http://{host}:15672/api/queues/{vhost}/) then some of the values you could use are:
"messages": 25,
"messages_details": {
"rate": 0
},
"messages_ready": 25,
"messages_ready_details": {
"rate": 0
},
"messages_unacknowledged": 0,
"messages_unacknowledged_details": {
"rate": 0
}
another one is:
"len": 25,
Those values should all be populated and changing in realtime.
Upvotes: 2