# Monitor Your RabbitMQ Metrics with OpenTelemetry and OpenObserve

> Learn how to effectively monitor RabbitMQ performance metrics using OpenTelemetry Collector. Master message queue monitoring, track broker health, and optimize your messaging infrastructure with our comprehensive guide.

Source: https://openobserve.ai/blog/monitor-rabbitmq-metrics-otel/
Published: 2025-02-28
Authors: Manas Sharma
Category: How To
Tags: Integrations, Metrics, OpenTelemetry

---

Are you looking to enhance your RabbitMQ monitoring strategy and ensure optimal message broker performance? In this comprehensive guide, we'll walk you through setting up advanced monitoring for RabbitMQ using OpenTelemetry and OpenObserve. Whether you're managing a small deployment or a large-scale messaging infrastructure, understanding your RabbitMQ metrics is crucial for maintaining reliable message delivery and system performance. By leveraging the RabbitMQ receiver of the OpenTelemetry Collector, you'll learn how to collect essential metrics, build informative dashboards, and set up alerts that keep your messaging system running smoothly.

## A Brief Overview of RabbitMQ

**RabbitMQ** is a powerful open-source message broker that implements the Advanced Message Queuing Protocol (AMQP). As a robust messaging solution, it acts as an intermediary for messaging, enabling applications to communicate and exchange data asynchronously. With features like **message queuing, routing, reliable delivery, and clustering**, RabbitMQ has become the backbone of modern distributed systems, powering microservices architectures, event-driven systems, and real-time data processing pipelines.

Monitoring RabbitMQ performance is essential for maintaining a healthy messaging ecosystem. In distributed systems where message brokers handle critical communication between services, any issues with message processing, queue backlogs, or consumer health can quickly escalate into system-wide failures. Effective **RabbitMQ monitoring** provides deep visibility into message flow patterns, queue performance, and consumer behavior, allowing teams to proactively identify bottlenecks, optimize resource utilization, and ensure reliable message delivery. By tracking key metrics like queue health, consumer count, and message flow, organizations can maintain optimal performance, scale resources efficiently, and prevent message-related incidents before they impact business operations.

## How Do We Monitor RabbitMQ Metrics?

To effectively monitor RabbitMQ, we utilize the OpenTelemetry Collector with its dedicated RabbitMQ receiver. This integration allows us to collect comprehensive metrics from RabbitMQ instances and forward them to OpenObserve for visualization and analysis. The RabbitMQ receiver connects to the RabbitMQ Management API, collecting detailed metrics about queues, messages, and consumers.

## RabbitMQ Receiver

The RabbitMQ receiver in OpenTelemetry fetches metrics from a RabbitMQ instance using the Management Plugin API. It collects various metrics that provide insights into message flow, queue status, and consumer health. The receiver is designed to work with both standalone RabbitMQ servers and clustered deployments.

### Default Metrics

The receiver provides several essential metrics out of the box:

| Metric                | Description                                       | Metric Name                     |
| --------------------- | ------------------------------------------------- | ------------------------------- |
| Consumer Count        | Number of consumers currently reading from queues | `rabbitmq.consumer.count`       |
| Messages Published    | Total number of messages published to queues      | `rabbitmq.message.published`    |
| Messages Delivered    | Number of messages delivered to consumers         | `rabbitmq.message.delivered`    |
| Messages Dropped      | Count of messages dropped as unroutable           | `rabbitmq.message.dropped`      |
| Messages Acknowledged | Number of messages acknowledged by consumers      | `rabbitmq.message.acknowledged` |
| Messages Current      | Total messages currently in queues                | `rabbitmq.message.current`      |

All these metrics are of type 'Sum' with value type 'Integer', providing cumulative measurements of RabbitMQ's operational status.

### Resource Attributes

The receiver automatically attaches these resource attributes to help identify and filter metrics:

| Name                | Description                | Values     | Enabled |
| ------------------- | -------------------------- | ---------- | ------- |
| rabbitmq.node.name  | Name of the RabbitMQ node  | Any String | true    |
| rabbitmq.queue.name | Name of the RabbitMQ queue | Any String | true    |
| rabbitmq.vhost.name | Name of the RabbitMQ vHost | Any String | true    |

### Configuration

Here's a sample configuration for the RabbitMQ receiver:

```yaml
receivers:
  rabbitmq:
    endpoint: http://localhost:15672
    username: otel
    password: password123
    collection_interval: 30s
    tls:
      insecure: true
      insecure_skip_verify: true
```

Key configuration parameters:

- **endpoint**: The URL of your RabbitMQ management API (default: http://localhost:15672)
- **username**: RabbitMQ user with monitoring permissions
- **password**: Authentication password
- **collection_interval**: How often metrics are collected (default: 1m)
- **tls**: TLS/SSL configuration for secure connections

## Getting Started

New to the Collector config file itself? Our [OpenTelemetry Collector Configuration Guide](https://openobserve.ai/blog/opentelemetry-collector-configuration-guide/) covers the full anatomy: receivers, processors, exporters, and pipelines, before you get into the RabbitMQ-specific setup below.

### Prerequisites

Before we begin setting up RabbitMQ monitoring, ensure you have:

1. **A Running RabbitMQ Instance**: Make sure you have RabbitMQ installed and running. If you're using Docker, you can start RabbitMQ with:

   ```bash
   docker run -d --name rabbitmq \
       -p 5672:5672 \
       -p 15672:15672 \
       rabbitmq:3.9-management
   ```

2. **RabbitMQ Management Plugin**: The Management plugin must be enabled for metric collection. It's included by default in the management image, but for manual installations, enable it with:

   ```bash
   rabbitmq-plugins enable rabbitmq_management
   ```

3. **Monitoring User**: Create a user with monitoring permissions:
   ```bash
   rabbitmqctl add_user otel password123
   rabbitmqctl set_user_tags otel monitoring
   rabbitmqctl set_permissions -p / otel ".*" ".*" ".*"
   ```

> _Note: The RabbitMQ receiver supports versions 3.8 and 3.9. Make sure your RabbitMQ instance is compatible._

![image6.png](/assets/image6_11708b9705.png)

### Step 2: Install the OpenTelemetry Collector

We'll use the **OpenTelemetry Collector Contrib distribution** as it includes the RabbitMQ receiver.

1. Download the latest <a href="https://github.com/open-telemetry/opentelemetry-collector-contrib/releases" target="_blank" rel="noopener noreferrer">release</a> for your machine. For macOS, use:

```bash
curl --proto '=https' --tlsv1.2 -fOL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.115.1/otelcol-contrib_0.115.1_darwin_arm64.tar.gz
```

2. Extract the downloaded file:

```bash
tar -xvf otelcol-contrib_0.115.1_darwin_arm64.tar.gz
```

3. Move the binary to your PATH:

```bash
sudo mv otelcol-contrib /usr/local/bin/
```

4. Verify the installation:

```bash
otelcol-contrib --version
```

![image2.png](/assets/image2_8b48b9541b.png)

### Step 3: Configure the OpenTelemetry Collector

Create a configuration file named `otel-collector-config.yaml` with the following content:

```yaml
receivers:
  rabbitmq:
    endpoint: http://localhost:15672
    username: otel
    password: password123
    collection_interval: 30s
    tls:
      insecure: true
      insecure_skip_verify: true

processors:
  batch:
    send_batch_size: 10000
    timeout: 10s

exporters:
  otlphttp/openobserve:
    endpoint: YOUR_API_ENDPOINT
    headers:
      Authorization: Basic YOUR_AUTH_TOKEN
      stream-name: default

service:
  pipelines:
    metrics:
      receivers: [rabbitmq]
      processors: [batch]
      exporters: [otlphttp/openobserve]
```

Replace `YOUR_API_ENDPOINT` and `YOUR_AUTH_TOKEN` with your OpenObserve credentials, which you can find in your OpenObserve dashboard under **Data Sources** -> **Custom** -> **Metrics** -> **Otel Collector**.

![image7.png](/assets/image7_052159e8af.png)

### Step 4: Run the OpenTelemetry Collector

Start the OpenTelemetry Collector with your configuration:

```bash
otelcol-contrib --config otel-collector-config.yaml
```

You should see collector logs indicating that the collector has started successfully and is receiving metrics from RabbitMQ.

### Step 5: Visualize Your Data in OpenObserve

Once metrics are flowing into OpenObserve, you can create powerful visualizations to monitor your RabbitMQ instance

![image3.png](/assets/image3_1772077585.png)

You can also access the RabbitMQ Management UI at `http://localhost:15672` to view real-time queue status and resource usage for quick operational insights.

![image8.png](/assets/image8_9b272eaa2c.png)

For comprehensive monitoring, we've prepared a complete RabbitMQ monitoring dashboard that includes:

- Message Flow Status
- Queue Depth Metrics
- Consumer Activity Tracking
- Processing Performance

![image1.gif](/assets/image1_5bddbaf6e1.gif)

You can download our pre-configured dashboards <a href="https://github.com/openobserve/dashboards" target="_blank" rel="noopener noreferrer">here</a> and import them directly into your OpenObserve instance.

### Step 6: Troubleshooting Connection Issues

If you encounter issues during setup, consider these common solutions:

1. **Management Plugin Access**
   - Verify the management plugin is enabled: `rabbitmq-plugins list`
   - Check the management interface is accessible: `curl -i http://localhost:15672`

2. **Authentication Issues**
   - Confirm user permissions: `rabbitmqctl list_user_permissions otel`
   - Verify user tags: `rabbitmqctl list_users`

3. **Network Connectivity**
   - Ensure ports 5672 (AMQP) and 15672 (Management API) are accessible
   - Check for any firewall rules blocking access

4. **TLS Configuration**
   - If using TLS, verify certificate paths and permissions
   - Consider using `insecure_skip_verify: true` for testing

## Conclusion

You've successfully set up comprehensive RabbitMQ monitoring using OpenTelemetry and OpenObserve. This setup provides valuable insights into your message broker's performance, helping you:

- Track message flow and processing rates
- Monitor queue depths and consumer health
- Identify bottlenecks and performance issues
- Ensure reliable message delivery

For a complete list of available metrics and configuration options, refer to the <a href="https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/rabbitmqreceiver" target="_blank" rel="noopener noreferrer">OpenTelemetry RabbitMQ Receiver Documentation</a>.

Happy monitoring! 🚀
