Bootstrap FreeKB - RabbitMQ - Listing ports using the REST API
RabbitMQ - Listing ports 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 and then list the nodes in the cluster.

curl
--request GET
--user john.doe:itsasecret
--url http://hostname:15671/api/nodes

 

Or, the details of a single node can be returned.

curl
--request GET
--user john.doe:itsasecret
--url http://hostname:15671/api/nodes/node001

 

A significant amount of JSON will be returned. The context array in the JSON should include the ports being used. In this example, port 15671 is being used for HTTPS (ssl) and port 15692 is being used for http/prometheus.

"contexts": [
            {
                "cowboy_opts": "[{sendfile,false}]",
                "description": "RabbitMQ Management",
                "path": "/",
                "port": "15671",
                "ssl": "true",
                "ssl_opts": {
                    "cacertfile": "/var/lib/rabbitmq/config/certs/ca_certificate_bundle.pem",
                    "certfile": "/var/lib/rabbitmq/config/certs/server_certificate.pem",
                    "keyfile": "/var/lib/rabbitmq/config/certs/server_key.pem",
                    "password": "itsasecret",
                    "port": "15671",
                    "versions": "['tlsv1.2']"
                }
            },
            {
                "cowboy_opts": "[{sendfile,false}]",
                "description": "RabbitMQ Prometheus",
                "path": "/",
                "port": "15692",
                "protocol": "'http/prometheus'"
            }
        ],

 




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 c3a091 in the box below so that we can be sure you are a human.