The rabbitmqctl command with the list_queues option can be used to list a virtual hosts queues. Or, the rabbitmqadmin list queues command can be used. Or, the curl command can be used.
rabbitmqctl list_queues
Which should produce something like this. By default, if the -p option is not used, the / virtual host will be used.
Listing queues for vhost / ...
name messages
queue001 0
queue002 0
The -p or --vhost option can be used to specify a virtual host, like this.
rabbitmqctl list_queues --vhost vhost001
Which should produce something like this.
Listing queues for vhost vhost001
name messages
queue001 0
queue002 17
Also by default, the number of messages in the queue will be included in the output. You can specify the items you wish to include in the output, like this.
rabbitmqctl list_queues --vhost vhost001 name state
Which should produce something like this.
Listing queues for vhost vhost001
name state
queue001 running
queue002 running
Following are the items that can be included in the output.
- arguments - list queue arguments
- auto_delete - whether or not the queue has auto_delete set
- consumers - list of consumers of the queue
- consumer_utilization - time to deliver messages to consumers
- disk_reads - number of times messages have been read from disk
- disk_writes - number of times messages have been written to disk
- durable - whether or not the queue is a durable queue
- exclusive - whether or not the queue is an exclusive queue
- exclusive_consumer_pid - Erlang PID
- exclusive_consumer_tag - consumer tag
- head_message_timestamp - timestamp of the first message in the queue
- memory - total amount of memory used
- message_bytes - size in bytes of messages
- message_bytes_persistent - size in bytes of persistent messages
- message_bytes_ready - size in bytes of ready messages
- message_bytes_unacknowledged - size in bytes of unacknowledged messages
- messages - total number of messages
- messages_persistent - number of persistent messages
- messages_ram - amount of memory used for all messages
- messages_ready - number of ready messages
- messages_ready_ram - amount of memory used for the ready messages
- messages_unacknowledged - number of unacknowledged messages
- messages_unacknowledged_ram - amount of memory used for the unacknowledged messages
- name - queue name
- owner_pid - Parent PID of Erlang PID
- pid - Erlang PID
- policy - policy name
- slave_pids - slave PIDs
- synchronized_slave_pids - PIDs of synchronized slaves
- state - running or idle
The --quiet option can be used to suppress "Listing queues ..." from the output.
rabbitmqctl list_queues --vhost vhost001 --quiet
Which should produce something like this.
name messages
queue001 0
queue002 17
The --formatter json option can be used to return the output in JSON.
rabbitmqctl list_queues --formatter json
Did you find this article helpful?
If so, consider buying me a coffee over at