Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 37 ยท Getting Started

Management UI and CLI Tools

Tour the RabbitMQ management UI, learn the key rabbitmqctl and rabbitmq-diagnostics commands, and read queue statistics from the HTTP API.

A broker you cannot see into is hard to trust. RabbitMQ ships with three ways to look inside and change things: a web management UI, a set of command-line tools and a management HTTP API that the UI itself is built on. You will use all three throughout this course.

Commands and URLs below are read-only examples for a broker on your own machine. The runnable block works on a small JSON sample written for this lesson (it is not output copied from a real broker), to show how scripts read the API.

The management UI

With the management plugin on, open http://localhost:15672 and log in (the guest user works from localhost). The top tabs map directly to the AMQP model you are about to learn:

Main tabs of the UI

Overview Message rates, totals, node and port summary.
Connections Every client connection and its channels.
Queues and Streams Ready, unacked and total messages per queue.
Exchanges Types, bindings and publish rates.

Admin covers users, vhosts, policies, limits and definitions import/export.

1 / 2

Useful things to try on the Queues page:

  • Click a queue to see its Ready, Unacked and Total counts. Ready messages wait for a consumer; Unacked messages were delivered but not yet acknowledged.
  • Open Publish message to type a test message into the queue by hand.
  • Use Get messages to peek at the head of the queue. Choose "Nack message requeue true" so peeking does not remove anything.
  • See the queue's consumers and which channel each one uses.

The Admin tab lets you create users, vhosts and policies (settings applied to many queues by name pattern, covered in Queue Arguments: TTL, Length and Dead Letters).

rabbitmqctl: the main CLI

rabbitmqctl administers a running node. Frequently used commands:

Terminal
rabbitmqctl status                     # node health, versions, memory, listeners
rabbitmqctl list_queues name messages consumers
rabbitmqctl list_exchanges name type
rabbitmqctl list_bindings
rabbitmqctl list_connections user peer_host state
rabbitmqctl list_users
rabbitmqctl list_vhosts
rabbitmqctl purge_queue hello          # delete every message in a queue
rabbitmqctl delete_queue hello

list_queues accepts column names after the command, so you only fetch what you need. Add -p shop to work in a vhost other than /. Destructive commands such as purge_queue and delete_queue act at once with no confirmation, so double-check the name.

Other command-line tools

RabbitMQ ships several small programs, each with one job:

  • rabbitmq-diagnostics: read-only health and inspection. Examples: rabbitmq-diagnostics ping, rabbitmq-diagnostics check_running, rabbitmq-diagnostics memory_breakdown, rabbitmq-diagnostics listeners.
  • rabbitmq-plugins: list, enable, disable.
  • rabbitmq-queues: queue-type specific operations, for example for quorum queues.
  • rabbitmq-streams: stream administration.
  • rabbitmq-upgrade: helps during rolling upgrades.
  • rabbitmqadmin: a client for the HTTP API, handy for scripts (declare queues, publish and fetch test messages, export definitions). A newer version 2 exists with a rewritten command set; check rabbitmqadmin --help for the one you installed.

Rule of thumb: use rabbitmq-diagnostics to look, rabbitmqctl to change.

The HTTP API

The management plugin serves JSON under /api. A few endpoints:

Endpoint What it returns
GET /api/overview Cluster-wide summary and message rates
GET /api/nodes Per-node memory, disk and file descriptors
GET /api/queues All queues with statistics
GET /api/queues/{vhost}/{name} One queue (vhost / is written %2F)
GET /api/exchanges All exchanges
GET /api/connections Client connections
GET /api/definitions Export of all users, vhosts, queues, exchanges, bindings
PUT /api/queues/{vhost}/{name} Declare a queue

Authenticate with HTTP Basic auth. For example:

Terminal
curl -u app_user:secret http://localhost:15672/api/queues/%2F/hello

Exporting definitions and importing them on a new broker is the standard way to copy topology (everything except messages).

Reading queue statistics in a script

Monitoring scripts boil down to: fetch JSON, pick fields, compare with a threshold. The sample below is invented for teaching and uses field names that match the real API (name, messages_ready, messages_unacknowledged, consumers).

Python Find unhealthy queues from API-style JSON

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Two alarms cover a lot of ground: messages waiting but no consumers and backlog growing. Later in the course you will see richer monitoring with Prometheus.

A command cheat table you can query

The next block is a small lookup written for practice: it maps a goal to the command that fulfils it. Extend it with your own entries.

Python Goal to command lookup

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Security notes

  • Create a dedicated admin user and delete or restrict guest.
  • Put the management port behind TLS and a firewall.
  • User tags (administrator, monitoring, management, policymaker) control what the UI lets someone do; give monitoring tools the monitoring tag only.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which tool should you prefer for read-only health checks?

    rabbitmq-diagnostics is designed for inspection. rabbitmqctl is the tool that changes state.
  2. 2. In the UI, what does "Ready" mean for a queue?

    Ready messages are in the queue waiting. Unacked messages have been sent to a consumer that has not acknowledged them yet.
  3. 3. How is the default vhost "/" written in an HTTP API path?

    The slash must be percent-encoded as %2F so it is not mistaken for a path separator.
  4. 4. What is the usual way to copy exchanges, queues, bindings and users to a new broker?

    Definitions describe topology and users but not messages, and can be exported from the UI or via GET /api/definitions.

Summary

  • The management UI, the CLI tools and the HTTP API show and change the same broker state.
  • rabbitmq-diagnostics looks, rabbitmqctl changes; rabbitmq-plugins manages plugins.
  • Watch Ready, Unacked and consumer counts; alert on waiting messages with no consumers.
  • Definitions export is how topology is copied between brokers.

Next: The AMQP 0-9-1 Model