This article follows the official documentation. We haven’t tested this tool for a hands-on review.
If a coding agent can run shell commands in a RabbitMQ environment, it can use rabbitmqadmin to inspect and manage broker resources through RabbitMQ’s HTTP management API. The broker is the server that routes messages; a queue holds messages until consumers receive them. For a low-risk task, ask the agent to list queues and report the properties shown in the output. The agent reads broker data by listing queues and changes it by importing definitions or creating or deleting resources.
RabbitMQ’s rabbitmqadmin v2 documentation explains installation and the available command groups. The tool requires RabbitMQ’s management plugin, which makes the HTTP API available. The example below contacts the API over the network. Checking the installed binary’s version runs only on the local machine.
Install and connect
RabbitMQ distributes rabbitmqadmin v2 as a standalone binary through GitHub releases and the Team RabbitMQ Homebrew tap. The documented native builds cover x86-64 Linux and ARM64 Linux. They also cover ARM64 macOS and x86-64 Windows. With Homebrew, the documented commands are:
brew tap rabbitmq/tap
brew install rabbitmqadmin
Then check the local installation:
rabbitmqadmin --version
rabbitmqadmin help
The management UI and its HTTP API usually listen on port 15672, according to the management plugin guide. Your broker must have the management plugin enabled, and the machine running rabbitmqadmin must be able to reach the API. For inspection, use a dedicated RabbitMQ user that is tagged monitoring and has empty permissions. The guide describes this as monitoring-only access. Such a user can list objects and read their metrics, but it cannot create or delete them.
Provide the password through your approved secret-injection method rather than writing it into an agent prompt or a checked-in file. rabbitmqadmin reads it from the RABBITMQADMIN_PASSWORD environment variable, so it does not have to appear in the command:
rabbitmqadmin \
--host <broker-host> \
--port 15672 \
--username <monitor-user> \
--vhost "/" \
--non-interactive \
queues list \
--columns "name,messages,consumers"
Replace <broker-host> and <monitor-user> with values for your environment. Set RABBITMQADMIN_PASSWORD outside the agent prompt. Global options such as --host and --vhost must come before the command group. The queues list command requests queue information, and --columns limits the output to the named columns. rabbitmqadmin v2 prints tables for people by default. With --non-interactive, it prints plain columns without table borders, which a script or an agent can parse more easily.
rabbitmqadmin v2 does not print JSON for most commands. Its README lists JSON output as a v1 feature that was dropped, except for the definitions commands, and points to the HTTP API for JSON. The --format=pretty_json option belongs to the old v1 tool. Ask the agent to report only fields that appear in the output. The broker version also affects which commands and fields are available.
This command reads broker data without changing it. The binary and shell commands run on the local machine. The command gets the queue list by sending a network request to the broker. The management API accepts HTTP Basic authentication, which sends a username and password with each request. When the connection crosses an untrusted network, enable HTTPS for the management API and pass --use-tls to rabbitmqadmin. Keep access to the management port restricted to the clients that need it.
Give the agent a read-only task
Ask the agent to check whether the expected queues exist and summarize the message counts shown in the output. It can run the listing command, compare the returned queue names with the names you specify, and report missing queues or counts. A zero message count only means that no messages are queued. It does not show whether consumers or the service are working.
For example, an agent prompt could say:
Run the approved rabbitmqadmin queue-list command against the configured broker. Report whether
ordersandnotificationsappear, and include their message counts only if the command returns that field. Do not create, delete, or modify broker resources.
Do not include the password in that prompt. The shell execution environment needs the secret to authenticate; the task prompt does not.
Keep imports and other changes separate
rabbitmqadmin also exports and imports broker definitions. These definitions describe broker resources, including queues and exchanges. They also describe users and policies. An import applies the definitions to the live broker and changes it, so treat imports as write operations. RabbitMQ’s production checklist recommends definition import for setting up a cluster’s resources at deployment time. Review the definition file and target broker before authorizing an import; do not treat exporting a file as a preview of what an import will change.
The HTTP API does not expose every operation available through RabbitMQ’s other command-line tools. The rabbitmqadmin documentation says it does not replace rabbitmqctl or rabbitmq-plugins, and RabbitMQ describes those tools in its command-line tools overview. Use rabbitmqadmin for management tasks exposed by the HTTP API, and check whether rabbitmqctl or rabbitmq-plugins is required when the requested operation concerns broker functions outside that API. Also verify compatibility between the installed rabbitmqadmin release and the RabbitMQ server. The documentation lists the supported RabbitMQ series, from 3.12.x up to 4.x, and older series do not support every command.