Technology
RabbitMQ
Monitor RabbitMQ message queues and cluster performance. Track queue depth, message rates, consumer health, and resource utilization.
Overview
Overview
RabbitMQ is a robust, reliable open-source message broker that implements multiple messaging protocols including AMQP, MQTT, and STOMP. It enables distributed applications to communicate through message queues, providing reliable message delivery, flexible routing, and clustering capabilities for high availability.
Use Cases
- Monitor queue depth and message throughput across all queues
- Track consumer performance and connection health
- Analyze memory usage and disk space consumption
- Monitor cluster health and node synchronization
- Track message publish, delivery, and acknowledgment rates
Setup
Overview
RabbitMQ exposes comprehensive metrics through its management plugin that can be collected using the OpenTelemetry Collector's RabbitMQ receiver. This integration provides deep visibility into queue performance, message rates, consumer health, and resource utilization.
Prerequisites
Before setting up RabbitMQ monitoring, ensure:
- RabbitMQ is running with the management plugin enabled
- The management API is accessible (default port: 15672)
- You have credentials to access the RabbitMQ management interface
- OpenTelemetry Collector is deployed in your environment using the OpenTelemetry Collector contrib distribution.
Setting up RabbitMQ
Using RabbitMQ Operator on Kubernetes
For Kubernetes environments, we recommend using the RabbitMQ Cluster Operator to deploy and manage RabbitMQ clusters.
Install the RabbitMQ Operator
kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml"Deploy a RabbitMQ Cluster
Create a RabbitMQ cluster with the management plugin enabled:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
name: rabbitmq
namespace: your-namespace
spec:
replicas: 3
rabbitmq:
additionalPlugins:
- rabbitmq_management
- rabbitmq_prometheus
additionalConfig: |
# Allow guest user from management UI
loopback_users.guest = falseManual RabbitMQ Setup
If deploying RabbitMQ manually, ensure the management plugin is enabled:
rabbitmq-plugins enable rabbitmq_managementCollector Configuration
The OpenTelemetry Collector uses the RabbitMQ receiver to collect metrics from the RabbitMQ management API. Add the following configuration to your collector:
receivers:
rabbitmq:
endpoint: http://rabbitmq-server:15672
username: ${env:RABBITMQ_USERNAME}
password: ${env:RABBITMQ_PASSWORD}
collection_interval: 10s
metrics:
# Node metrics
rabbitmq.node.disk_free:
enabled: true
rabbitmq.node.mem_used:
enabled: true
rabbitmq.node.mem_limit:
enabled: true
rabbitmq.node.fd_used:
enabled: true
rabbitmq.node.fd_total:
enabled: true
rabbitmq.node.sockets_used:
enabled: true
rabbitmq.node.sockets_total:
enabled: true
rabbitmq.node.proc_used:
enabled: true
rabbitmq.node.proc_total:
enabled: trueFor more configuration options see the receiver documentation in the OpenTelemetry Collector contrib repository
Environment Variables
Configure the following environment variables for the collector:
RABBITMQ_USERNAME: RabbitMQ management usernameRABBITMQ_PASSWORD: RabbitMQ management password
Collector Deployment
Deploy the OpenTelemetry Collector with the RabbitMQ receiver configuration. For detailed deployment instructions, see our other integrations for deploying the OpenTelemetry Collector:
Verification
After configuring the collector, verify that metrics are being collected:
- Check the collector logs for successful connections to RabbitMQ
- Navigate to the Metrics Explorer in Dash0
- Search for metrics with prefix
rabbitmq. - Verify key metrics like
rabbitmq.message.publishedandrabbitmq.node.mem_usedare appearing
Available Metrics
The RabbitMQ receiver collects the following key metrics:
Node Metrics
rabbitmq.node.disk_free: Available disk spacerabbitmq.node.mem_used: Memory usagerabbitmq.node.fd_used: File descriptors in userabbitmq.node.sockets_used: Network sockets in userabbitmq.node.proc_used: Erlang processes in use
Message Metrics
rabbitmq.message.published: Messages published to queuesrabbitmq.message.delivered: Messages delivered to consumersrabbitmq.message.acknowledged: Messages acknowledged by consumersrabbitmq.message.current: Current messages in queues (ready and unacknowledged)
Consumer Metrics
rabbitmq.consumer.count: Number of consumers connected
