0
0
RabbitMQdevops~5 mins

Key metrics to monitor in RabbitMQ - Commands & Configuration

Choose your learning style9 modes available
Introduction
Monitoring key metrics in RabbitMQ helps you keep your message broker healthy and efficient. It shows you if messages are flowing well or if there are problems like slow consumers or full queues.
When you want to check if your RabbitMQ server is handling messages without delays
When you need to find out if queues are filling up and might cause message loss
When you want to monitor how many messages are being published and consumed
When you suspect consumers are slow or stuck and want to confirm
When you want to track resource usage like memory and disk to avoid crashes
Commands
This command shows the overall status of the RabbitMQ server including memory, disk, and running nodes.
Terminal
rabbitmqctl status
Expected OutputExpected
Status of node rabbit@my-server ... [{pid,12345}, {running_applications,[{rabbit,"RabbitMQ","3.11.10"},{os_mon,"CPO CXC 138 46"}]}, {memory,[{total,104857600},{connection_readers,123456},{connection_writers,123456}]}, {disk_free,5000000000}, {alarms,[]}]
Lists all queues with their name, number of messages ready to be delivered, and number of consumers connected.
Terminal
rabbitmqctl list_queues name messages consumers
Expected OutputExpected
queue1 10 2 queue2 0 1 queue3 5 0
Shows all exchanges with their type and the number of messages published to them.
Terminal
rabbitmqctl list_exchanges name type messages
Expected OutputExpected
amq.direct direct 100 amq.fanout fanout 50 my-exchange direct 200
Displays all current connections with their state and how many channels each connection has open.
Terminal
rabbitmqctl list_connections name state channels
Expected OutputExpected
127.0.0.1:5672 running 3 192.168.1.10:5672 running 1
Lists consumers for each queue, showing if they require acknowledgments which affects message reliability.
Terminal
rabbitmqctl list_consumers queue consumer_tag ack_required
Expected OutputExpected
queue1 consumer1 true queue2 consumer2 false
Key Concept

If you remember nothing else from monitoring RabbitMQ, remember: watch queue message counts and consumer activity to catch bottlenecks early.

Common Mistakes
Ignoring the number of consumers on a queue
If no consumers are connected, messages pile up and cause delays or memory issues.
Always check consumers count with queues to ensure messages are being processed.
Not monitoring memory and disk usage
RabbitMQ can crash or slow down if memory or disk space runs out.
Use 'rabbitmqctl status' regularly to watch resource usage.
Only checking messages published but not messages ready in queues
High published messages with low ready messages might hide consumer problems.
Check both published messages on exchanges and ready messages in queues.
Summary
Use 'rabbitmqctl status' to check server health and resource usage.
List queues with message and consumer counts to find bottlenecks.
Check exchanges for message publishing rates.
Monitor connections and consumers to ensure smooth message flow.