RabbitMQ - Display shovel status using the rabbitmqctl shovel_status command

A shovel is used to move a message from a queue or exchange to a different queue or exchage. The queues or exchanges can reside on the same RabbitMQ node or on different RabbitMQ nodes.

 

AVOID TROUBLE

Before you can create a shovel, the rabbitmq_shovel plugin will need to be enabled, and you may want to also enable the rabbitmq_shovel_management plugin so that you can use Shovel Status and Shovel Management in the RabbitMQ web browser console and the RabbitMQ REST API to list/create/delete dynamic shovels. The rabbitmq-plugins list command can be used to determine if the plugins are enabled. If not, the rabbitmq-plugins enable command can be used to enable the plugins.

If the RabbitMQ node is not using SSL, the src-uri or dest-uri should start with amqp://. If SSL is being used, the src-uri or dest-uri should start with amqps://.

 

There are two types of shovels.

 

Here is an example of how you could use the rabbitmqctl command with the shovel_status option to return the status of each shovel.

rabbitmqctl shovel_status

 

Something like this should be returned.

Shovel status on node rabbit@server001

destination        destination_protocol  destination_queue  last_changed         name       source
source_exchange  source_exchange_key  source_protocol state   termination_reason  type     vhost

amqp:///shovel001  amqp091               queue001           2021-02-28 03:08:04  shovel001  amqp://rabbitmq.example.com:5672/%2F
exchange001      key001               amqp091         running                     dynamic  vhost001

amqp:///shovel002  amqp091               queue002           2021-02-28 03:08:04  shovel002  amqp://rabbitmq.example.com:5672/%2F
exchange001      key004               amqp091         running                     dynamic  vhost001

amqp:///shovel003  amqp091               queue001           2021-02-28 03:08:04  shovel003  amqp://rabbitmq.example.com:5672/%2F
exchange002      key001               amqp091         running                     dynamic  vhost002

 

If there is a shovel that is in a "terminated" state, something like this should be returned.

2021-06-03 23:11:25     shovel002               terminated      "needed a restart"      dynamic /

The rabbitmqctl shovel_status command may return a shovel that has been deleted using the rabbitmqctl delete_shovel or rabbitmqctl clear_parameter commands. In this scenario, restarting the RabbitMQ service should make it so that the rabbitmqctl shovel_status command does not return the shovel in the list of shovels.

 

The --formatter json option can be used to return the output in JSON and then this can be piped through the python command to return JSON formatted output.

rabbitmqctl shovel_status --formatter json | python -m json.tool
[
    {
        "destination": "amqp:///foo",
        "destination_protocol": "amqp091",
        "destination_queue": "a.queue",
        "last_changed": "2022-02-03 08:58:51",
        "name": "a.shovel",
        "source": "amqp:///bar",
        "source_exchange": "a.exchange",
        "source_exchange_key": "#.#.#.#",
        "source_protocol": "amqp091",
        "state": "running",
        "termination_reason": "",
        "type": "dynamic",
        "vhost": "foo"
    }
]

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 22e3e in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |