RabbitMQ
vhosts
List Queues
Server Management
Messaging Systems

RabbitMQ: list queues on all vhosts with rabbitmqctl

Codemia Knowledge Hub ·

rabbitmqctl list_queues -p VHOST_NAME lists the queues in one virtual host. To cover all vhosts, run it once per vhost, which is easiest in a loop over rabbitmqctl list_vhosts. The management UI and HTTP API work too.

Each vhost is an isolated namespace with its own queues, exchanges, bindings and permissions. Vhosts work like namespaces. That isolation is what lets different applications, development environments or tenants operate independently inside one RabbitMQ instance, and it lets you segment broad operational domains on a single broker. Because permissions are controlled per vhost, you also get detailed access control.

Because of that isolation, rabbitmqctl list_queues works one vhost at a time. To monitor queue health, tune performance or troubleshoot across the whole broker, an administrator needs the queue information from each vhost.

Listing queues with rabbitmqctl

For one vhost:

bash
rabbitmqctl list_queues -p VHOST_NAME

rabbitmqctl is the command-line tool for RabbitMQ administration, but list_queues only covers the vhost you pass with -p. To list every vhost, run it once per vhost. You can automate that by looping over the output of list_vhosts:

bash
1for vhost in $(rabbitmqctl list_vhosts --silent); do
2    echo "Queues in vhost '$vhost':"
3    rabbitmqctl list_queues -p "$vhost"
4    echo ""
5done

The loop iterates over the vhosts and prints the queues in each one, with a heading per vhost. --silent drops the "Listing vhosts ..." banner and the name header row, which the loop would otherwise treat as vhost names.

Using the management UI

The RabbitMQ Management Interface is a web UI that ships with RabbitMQ and is one of the most user-friendly ways to browse queues. After logging in, an administrator can switch between vhosts to see the queues in each one.

Using the HTTP API

To list queues from scripts or applications, send a GET request to the HTTP API:

curl
curl -u user:password http://your-rabbitmq-server:15672/api/queues/vhost_name

Replace vhost_name with your vhost. To cover all vhosts in one call, drop the vhost and request /api/queues, which lists every queue across all vhosts with a reduced set of fields.

What to look at in the listing

When you list queues, these fields are the most useful. Messages ready are waiting to be delivered to consumers, unacknowledged messages have been delivered but not yet acknowledged, and the total is the sum of the two.

MetricDescription
NameIdentifier of the queue
StateOperational state of the queue, such as running or paused
Messages ReadyNumber of messages ready for delivery
Messages UnacknowledgedMessages delivered but not yet acknowledged
Total MessagesSum of ready and unacknowledged messages

Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design