Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rabbitmq list queues on all vhosts

I've got rabbitmq with couple virtual hosts, there is few queues on each. How can I list all queues from all vhosts using rabbitmqctl? I've tried:

rabbitmqctl list_queues -p /*
rabbitmqctl list_queues -p *
rabbitmqctl list_queues -p /
rabbitmqctl list_queues -p ./*

Any ideas?

like image 402
Damian Słowiński Avatar asked May 05 '17 08:05

Damian Słowiński


3 Answers

try with this:

#!/bin/bash
IFS=$'\n'
ordered_vhosts=$(./rabbitmqctl list_vhosts -q | xargs -n1 | sort -u)

for V in $ordered_vhosts; do
    echo "*****Vhost $V Total queues " $(./rabbitmqctl list_queues -q -p $V | wc -l)
    for Q in $(./rabbitmqctl list_queues -q name messages -p $V | xargs -n2 | sort -u); do
        echo "Vhost $V queue-name total-messages $Q"
    done
done
like image 77
Gabriele Santomaggio Avatar answered Nov 10 '22 19:11

Gabriele Santomaggio


You can use for i in $(rabbitmqctl list_vhosts); do echo vhost: $i && rabbitmqctl list_queues -p $i; done to just run from the command line

like image 8
Kyle Avatar answered Nov 10 '22 19:11

Kyle


It works for me

rabbitmqctl list_vhosts | xargs -n1  rabbitmqctl list_queues -p
like image 2
Silvio Avatar answered Nov 10 '22 18:11

Silvio