Skip to main content

RabbitMQ operations

v0.1.18

Cluster, queue, exchange, binding, connection, channel, and consumer inventory plus narrow operator actions (purge_queue, set_policy, force_close_connection). Uses rabbitmqctl + rabbitmqadmin on the runner host.

15 allowed by default 2 need approval by default 1 denied by default
Pack ID
rabbitmq
Vendor
emisar
OS
linux
Actions
18
Required binaries. Install these on the host before relying on the pack — an action that calls a missing one fails at run time.
rabbitmq-diagnostics rabbitmqctl

Install

emisar pack install fetches this pack, re-validates it, and verifies its content hash against the --hash below — the exact bytes this page was rendered against, so a tampered copy is rejected — before copying it into the runner's packs dir. The command reloads a running daemon itself; no manual restart.

on the runner host
sudo emisar pack install rabbitmq --hash sha256:f09309c5eea749caaceec12b634f1a4d0e75bfd72ca7f00f485158a562cc2751

Setup

rabbitmqctl and rabbitmq-diagnostics talk to the RabbitMQ node on the same host and authenticate with the Erlang cookie, not a username or URL. No connection env vars — provisioning is about running as the right user.

Host access

Run these commands yourself on the runner host. Emisar shows and copies setup recipes; it never runs them.

Read RabbitMQ's Erlang cookie and act as a local node administrator.

rmq.cluster_statusrmq.node_health_checkrmq.list_nodesrmq.list_vhostsrmq.list_usersrmq.list_policiesrmq.list_parametersrmq.list_queuesrmq.list_exchangesrmq.list_bindingsrmq.list_connectionsrmq.list_channelsrmq.list_consumersrmq.purge_queuermq.close_connectionrmq.sync_queuermq.start_apprmq.stop_app

Run the Emisar service as root with RabbitMQ's live cookie

Grant access
sudo install -d -m 0755 /etc/systemd/system/emisar.service.d
printf '%s\n' '[Service]' 'User=root' 'Group=root' | sudo tee /etc/systemd/system/emisar.service.d/10-rabbitmq-host-access.conf >/dev/null
sudo systemctl daemon-reload
sudo systemctl restart emisar
Verify access
test "$(systemctl show emisar --property=User --value)" = root
sudo env HOME=/var/lib/rabbitmq rabbitmq-diagnostics -q ping

Impact: Every Emisar action on this runner executes as root. Root can use the live Erlang cookie selected by the pack to administer the local node, including operations outside this pack.

Notes

  • These tools target the local node only. To manage a remote node you would need -n <node>, which these actions do not set.

Verify it works

Runs rmq.node_health_check, a low-risk read that confirms the pack can reach its target. Run it on the host once the pack is installed; pack install runs it for you.

on the runner host
sudo emisar pack verify rabbitmq

Install and configure a pack walks through the whole sequence on a host.

Actions 18 total

View on GitHub
  • rmq.close_connection exec high High — service-affecting

    rabbitmqctl close_connection

    Forcibly closes one AMQP connection. Whatever client owned it must reconnect.

    View source on GitHub
  • rmq.cluster_status exec low Low — read-only or trivially reversible

    rabbitmqctl cluster_status

    Show cluster summary: nodes, alarms, partitions.

    View source on GitHub
  • rmq.list_bindings exec low Low — read-only or trivially reversible

    rabbitmqctl list_bindings

    List all bindings between exchanges and queues.

    View source on GitHub
  • rmq.list_channels exec low Low — read-only or trivially reversible

    rabbitmqctl list_channels

    List all open channels with consumer + prefetch + ack stats.

    View source on GitHub
  • rmq.list_connections exec low Low — read-only or trivially reversible

    rabbitmqctl list_connections

    List all open AMQP connections with client + user + channels.

    View source on GitHub
  • rmq.list_consumers exec low Low — read-only or trivially reversible

    rabbitmqctl list_consumers

    List all active consumers + their queue + ack-mode + prefetch.

    View source on GitHub
  • rmq.list_exchanges exec low Low — read-only or trivially reversible

    rabbitmqctl list_exchanges

    List all exchanges with type + durability.

    View source on GitHub
  • rmq.list_nodes exec low Low — read-only or trivially reversible

    Known cluster nodes

    List all known cluster nodes.

    View source on GitHub
  • rmq.list_parameters exec low Low — read-only or trivially reversible

    rabbitmqctl list_parameters

    List runtime parameters (federation upstreams, shovel definitions, etc).

    View source on GitHub
  • rmq.list_policies exec low Low — read-only or trivially reversible

    rabbitmqctl list_policies

    List all set policies (HA, federation, shovel, etc).

    View source on GitHub
  • rmq.list_queues exec low Low — read-only or trivially reversible

    rabbitmqctl list_queues

    List all queues with name, messages_ready, messages_unacknowledged, consumers, memory. The canonical "is anything backing up?" check.

    View source on GitHub
  • rmq.list_users exec low Low — read-only or trivially reversible

    rabbitmqctl list_users

    List all users + tags.

    View source on GitHub
  • rmq.list_vhosts exec low Low — read-only or trivially reversible

    rabbitmqctl list_vhosts

    List all virtual hosts.

    View source on GitHub
  • rmq.node_health_check exec low Low — read-only or trivially reversible

    rabbitmq-diagnostics check_running

    Check health — confirms the local node is running and reachable.

    View source on GitHub
  • rmq.purge_queue exec critical Critical — data loss or irreversible

    rabbitmqctl purge_queue

    Drop every message in one queue. Unprocessed messages are lost.

    View source on GitHub
  • rmq.start_app exec medium Medium — changes state, easily reversible

    rabbitmqctl start_app

    Start the RabbitMQ application within an already-running node. Companion to stop_app, used during cluster joins/leaves.

    View source on GitHub
  • rmq.stop_app exec high High — service-affecting

    rabbitmqctl stop_app

    Stop the RabbitMQ application while keeping the Erlang node running. Required before reset/join_cluster. All clients disconnect.

    View source on GitHub
  • rmq.sync_queue exec medium Medium — changes state, easily reversible

    rabbitmqctl sync_queue

    Force a mirrored classic queue to sync with its master. Producers and consumers continue to operate; the sync runs in the background. Use when an unsynced mirror is blocking a master failover.

    View source on GitHub