• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

Monitor self-hosted RabbitMQ with OpenTelemetry

Monitor RabbitMQ running on Linux hosts by installing and configuring the OpenTelemetry Collector. This comprehensive guide walks you through installation, configuration, and verification for Debian, Ubuntu, RHEL, and CentOS systems.

Installation steps

Follow these steps in order to set up monitoring for your self-hosted RabbitMQ instance.

Before you begin

Make sure your environment meets these requirements:

Enable the RabbitMQ management plugin

The management plugin exposes the API that the OpenTelemetry Collector scrapes:

bash
$
sudo rabbitmq-plugins enable rabbitmq_management

Verify it's working:

bash
$
curl -I -u admin:password http://localhost:15672/api/overview

You should see HTTP/1.1 200 OK in the response.

Configure the collector

Create or replace /etc/otelcol-contrib/config.yaml:

receivers:
rabbitmq:
endpoint: http://localhost:15672
username: admin
password: password
collection_interval: 30s
metrics:
# Queue Metrics (essential for message flow and backlog)
rabbitmq.consumer.count:
enabled: true
rabbitmq.message.delivered:
enabled: true
rabbitmq.message.published:
enabled: true
rabbitmq.message.acknowledged:
enabled: true
rabbitmq.message.dropped:
enabled: true
rabbitmq.message.current:
enabled: true # Crucial for monitoring queue backlog, includes 'ready' and 'unacknowledged' states
# Node Health Metrics (critical for server resource monitoring)
rabbitmq.node.disk_free:
enabled: true
rabbitmq.node.disk_free_limit:
enabled: true
rabbitmq.node.disk_free_alarm:
enabled: true
rabbitmq.node.mem_used:
enabled: true
rabbitmq.node.mem_limit:
enabled: true
rabbitmq.node.mem_alarm:
enabled: true
rabbitmq.node.mem_used_details.rate:
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: true
rabbitmq.node.uptime:
enabled: true
rabbitmq.node.run_queue:
enabled: true
rabbitmq.node.processors:
enabled: true
rabbitmq.node.context_switches_details.rate:
enabled: true
rabbitmq.node.gc_num_details.rate:
enabled: true
rabbitmq.node.gc_bytes_reclaimed_details.rate:
enabled: true
# I/O Metrics (important for understanding disk and network activity)
rabbitmq.node.io_read_count_details.rate:
enabled: true
rabbitmq.node.io_read_bytes_details.rate:
enabled: true
rabbitmq.node.io_read_avg_time_details.rate:
enabled: true
rabbitmq.node.io_write_count_details.rate:
enabled: true
rabbitmq.node.io_write_bytes_details.rate:
enabled: true
rabbitmq.node.io_write_avg_time_details.rate:
enabled: true
rabbitmq.node.io_sync_count_details.rate:
enabled: true
rabbitmq.node.io_sync_avg_time_details.rate:
enabled: true
rabbitmq.node.io_seek_count_details.rate:
enabled: true
rabbitmq.node.io_seek_avg_time_details.rate:
enabled: true
rabbitmq.node.io_reopen_count_details.rate:
enabled: true
# Mnesia and Store Metrics (for internal database and message storage)
rabbitmq.node.mnesia_ram_tx_count_details.rate:
enabled: true
rabbitmq.node.mnesia_disk_tx_count_details.rate:
enabled: true
rabbitmq.node.msg_store_read_count_details.rate:
enabled: true
rabbitmq.node.msg_store_write_count_details.rate:
enabled: true
rabbitmq.node.queue_index_write_count_details.rate:
enabled: true
rabbitmq.node.queue_index_read_count_details.rate:
enabled: true
# Connection/Channel/Queue Lifecycle Metrics
rabbitmq.node.connection_created_details.rate:
enabled: true
rabbitmq.node.connection_closed_details.rate:
enabled: true
rabbitmq.node.channel_created_details.rate:
enabled: true
rabbitmq.node.channel_closed_details.rate:
enabled: true
rabbitmq.node.queue_declared_details.rate:
enabled: true
rabbitmq.node.queue_created_details.rate:
enabled: true
rabbitmq.node.queue_deleted_details.rate:
enabled: true
# processors: Process data before exporting.
processors:
resourcedetection:
detectors: [system]
system:
resource_attributes:
host.name:
enabled: true
host.id:
enabled: true
resource:
attributes:
- key: instrumentation.provider
value: opentelemetry
action: upsert
- key: rabbitmq.deployment.name
value: my-rabbitmq-server # Replace with your server name
action: upsert
batch:
send_batch_size: 1024
timeout: 30s
exporters:
otlphttp/newrelic:
endpoint: ${env:NEWRELIC_OTLP_ENDPOINT}
headers:
api-key: ${env:NEWRELIC_LICENSE_KEY}
compression: gzip
service:
pipelines:
metrics:
receivers: [rabbitmq]
processors: [resourcedetection, resource, batch]
exporters: [otlphttp/newrelic]

Update these values in the configuration:

  • endpoint: Your RabbitMQ management API URL (default: http://localhost:15672)
  • username and password: Your RabbitMQ credentials
  • rabbitmq.deployment.name: A unique name for this RabbitMQ instance
  • collection_interval: How often to scrape metrics (default: 30 seconds)

Set environment variables

Create a systemd override file for environment variables:

bash
$
sudo mkdir -p /etc/systemd/system/otelcol-contrib.service.d

Choose your New Relic region:

bash
$
cat <<EOF | sudo tee /etc/systemd/system/otelcol-contrib.service.d/environment.conf
$
[Service]
$
Environment="NEWRELIC_OTLP_ENDPOINT=https://otlp.nr-data.net:4318"
$
Environment="NEWRELIC_LICENSE_KEY=YOUR_LICENSE_KEY"
$
EOF

Replace YOUR_LICENSE_KEY with your New Relic license key.

bash
$
cat <<EOF | sudo tee /etc/systemd/system/otelcol-contrib.service.d/environment.conf
$
[Service]
$
Environment="NEWRELIC_OTLP_ENDPOINT=https://otlp.eu01.nr-data.net:4318"
$
Environment="NEWRELIC_LICENSE_KEY=YOUR_LICENSE_KEY"
$
EOF

Replace YOUR_LICENSE_KEY with your New Relic license key.

Reload systemd and restart the collector:

bash
$
sudo systemctl daemon-reload
$
sudo systemctl restart otelcol-contrib

Verify your data in New Relic

Check the service status:

bash
$
sudo systemctl status otelcol-contrib

You should see active (running) in the output.

View recent logs:

bash
$
sudo journalctl -u otelcol-contrib -n 50 --no-pager

Look for messages indicating successful metric collection:

INFO RabbitmqReceiver Successfully scraped rabbitmq metrics

Verify metrics in New Relic:

Wait 2-3 minutes for data to appear, then run this query in the query builder:

SELECT count(*)
FROM Metric
WHERE metricName LIKE 'rabbitmq.%'
AND instrumentation.provider = 'opentelemetry'
AND rabbitmq.deployment.name = 'my-rabbitmq-server'
FACET metricName
SINCE 10 minutes ago

You should see metric names like:

  • rabbitmq.queue.count - Number of queues
  • rabbitmq.queue.message.count - Total messages across queues
  • rabbitmq.connection.count - Active connections
  • rabbitmq.consumer.count - Active consumers

Conseil

If you don't see data after 5 minutes, check the troubleshooting section below.

(Optional) Forward RabbitMQ logs to New Relic

In addition to metrics, you can forward RabbitMQ application logs to New Relic for comprehensive observability. This helps correlate issues across metrics and logs.

Important

Log forwarding requires additional configuration and system permissions. Ensure you have the necessary access before proceeding.

Update /etc/otelcol-contrib/config.yaml to add the filelog receiver:

receivers:
rabbitmq:
# ... existing rabbitmq config ...
# Add filelog receiver for RabbitMQ logs
filelog/rabbitmq:
include:
- /var/log/rabbitmq/*.log
- /var/log/rabbitmq/**/*.log
include_file_path: true
include_file_name: false
operators:
- type: regex_parser
regex: '^(?P<timestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}) \[(?P<level>\w+)\] <(?P<pid>[^>]+)> (?P<message>.*)$'
timestamp:
parse_from: attributes.timestamp
layout: '%Y-%m-%d %H:%M:%S.%L'
severity:
parse_from: attributes.severity
processors:
# ... existing processors ...
transform/rabbitmq_logs:
log_statements:
- context: resource
statements:
- set(attributes["rabbitmq.display.name"], Concat(["server", attributes["rabbitmq.deployment.name"]], ":"))
service:
pipelines:
metrics:
receivers: [rabbitmq]
processors: [resourcedetection, resource, batch]
exporters: [otlphttp/newrelic]
logs/rabbitmq:
receivers: [filelog]
processors: [batch, resource, transform/rabbitmq_logs]
exporters: [otlphttp/newrelic]

Grant the collector permission to read logs. Choose one method:

Add to rabbitmq group:

bash
$
sudo usermod -a -G rabbitmq otelcol-contrib

Or set file permissions:

bash
$
sudo chmod 644 /var/log/rabbitmq/*.log

Restart the collector:

bash
$
sudo systemctl restart otelcol-contrib

Verify logs are being collected in New Relic:

SELECT count(*)
FROM Log
WHERE service.name = 'rabbitmq'
AND rabbitmq.deployment.name = 'my-rabbitmq-server'
SINCE 10 minutes ago

Find your data

After a few minutes, your RabbitMQ metrics should appear in New Relic. See Find and query your data for detailed instructions on exploring your RabbitMQ metrics across different views in the New Relic UI.

You can also query your data with NRQL:

FROM Metric SELECT * WHERE rabbitmq.deployment.name = 'my-rabbitmq-server'

Troubleshooting

Next steps

Now that you have RabbitMQ monitoring set up, you can enhance your observability:

Explore your data:

Enhance monitoring:

  • Create alerts - Set up alerts for queue depths and message backlogs
  • Build dashboards - Create custom dashboards to visualize your RabbitMQ metrics
Droits d'auteur © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.