[rabbitmq-discuss] Queue info
Tony Garnock-Jones
tonyg at lshift.net
Thu Feb 28 07:15:20 GMT 2008
Hi Ying,
Ying He wrote:
> Is there any way in RabbitMQ server for the admin to check for example:
> How many queues are currently in the system?
> How many messages that each one has processed and each one still holds
> waiting for the consumer to process?
There is an undocumented way of doing this. If you start the broker by
running rabbitmq-server, then you end up at an erlang shell (if you
don't see the prompt, tap enter to make it reprint it). If you have the
broker running in the background, you need to attach an erlang shell to
it, with a command along the lines of "erl -sname temp -remsh
rabbit at yourmachine", running as the same user as the rabbit server.
At the erlang prompt, type "rabbit_amqqueue:stat_all().", which will
produce a brief report on the status of the queues in the system. This
tells you how many there are, how many consumers are listening on each,
and how many messages are backlogged on each. There is no indication of
how many messages have been through the queues yet. For example:
(rabbit at walk)1> rabbit_amqqueue:stat_all().
[{ok,{resource,<<"/">>,queue,<<"bar">>},0,1},
{ok,{resource,<<"/">>,queue,<<"foo">>},0,1}]
The example shows two queues, "foo" and "bar", each with a single
consumer attached (in fact a LogTail.exe instance from our .NET client),
and neither with any messages waiting to be consumed. The result of the
stat_all() call is a list of {status, fully-qualified-queue-name,
message-queue-length, consumer-count} tuples.
Regards,
Tony
More information about the rabbitmq-discuss
mailing list