Bootstrap FreeKB - RabbitMQ - Listing connections using the rabbitmqctl list_connections command
RabbitMQ - Listing connections using the rabbitmqctl list_connections command

Updated:   |  RabbitMQ articles

With RabbitMQ, a connection and a channel are similar, but not exactly the same. A connection is the TCP connection that an application makes to RabbitMQ. The connection will have one or more channels, and the AMPQ tasks, such as publishing or consuming messages, are done over the channel.

 

The rabbitmqctl command with the list_connection option can be used to list all of the current connections.

~]# rabbitmqctl list_connections
Listing connections ...
user            peer_host       peer_port   state
john.doe        10.17.16.122    34715       running
jane.doe        10.14.17.113    57745       running
jack.doe        10.17.16.122    60765       running

 

By default, the user that initiated the connection, the users IP address and port, and the state of the connection will be returned. You can include the fields you want returned, such as user, name and state.

~]# rabbitmqctl list_connections user name state
Listing connections ...
user            name                                      state
john.doe        10.17.16.122:34715 -> 10.9.15.201:5671    running
jane.doe        10.14.17.113:57745 -> 10.9.15.201:5671    running
jack.doe        10.17.16.122:60765 -> 10.9.15.201:5671    running

 

Here are all of the possible options.

  • auth_mechanism - SASL authentication method such as PLAIN
  • channels - number of channels the connection has
  • channel_max - maximum allowed channels
  • client_properties - will be listed
  • connected_at - date time
  • frame_max - max frame size
  • host - RabbitMQ server hostname
  • name - source IP and port and destination IP and port
  • peer_host - client hostname
  • peer_port - client ephemeral port
  • pid - Id of the Erlang process associated with the connection
  • port - RabbitMQ server port
  • protocol - AMP protocol such as 0.9.1
  • recv_cnt - number of TCP packets received
  • recv_oct - octets received
  • send_cnt - number of TCP packets sent
  • send_oct - octets sent
  • send_pend - send queue size
  • ssl - Was SSL used?
  • ssl_cert_issuer - issuer of the public certificate
  • ssl_cert_subject - public certificate subject
  • ssl_cert_validity - issued date and expiration date
  • ssl_cipher - such as aes_256_cbc
  • ssl_hash - such as SHA
  • ssl_key_exchange - such as RSA
  • ssl_protocol - the SSL protocol
  • state - usually running
  • timeout - timeout period for the connection
  • user - the user that made the connection
  • virtual host - the virtual host

 

The --formatter json option can be used to return the output in JSON.

rabbitmqctl list_connections --formatter json

 

 

 




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