Bootstrap FreeKB - RabbitMQ - List Virtual Hosts using the REST API
RabbitMQ - List Virtual Hosts using the REST API

Updated:   |  RabbitMQ articles

This assumes you have created a RabbitMQ user with the administrator tag.

Refer to the RabbitMQ REST API documentation.

The curl command with the --user option can be used to make an API connection to RabbitMQ. In this example, John Doe will make a connection to the RabbitMQ server listening on port 15671. Or, the rabbitmqctl list_queues or rabbitmqadmin list queues commands can be used.

curl --user john.doe:itsasecret http://hostname:15671/api/vhosts

 

Or, you can specify a single virtual host.

curl --user john.doe:itsasecret http://hostname:15671/api/vhosts/foo

 

For the / vhost, use %2F.

curl --user john.doe:itsasecret http://hostname:15671/api/vhosts/%2F

 

Something like this should be returned for each virtual host.

{
 "cluster_state": {
   "rabbit@server1": "running",
   "rabbit@server2": "running"
 },
 "description": "example description",
 "metadata": {
   "description": "example description",
   "tags": []
 },
 "name":"foo",
 "tracing":false,
 "cluster_state":{"rabbit@server01":"running"},
 "messages_ready":18,
 "messages_ready_details":{"rate":0.0},
 "messages_unacknowledged":0,
 "messages_unacknowledged_details":{"rate":0.0},
 "messages":18,
 "messages_details":{"rate":0.0}
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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