Bird
Raised Fist0
RabbitMQdevops~10 mins

Prometheus and Grafana integration in RabbitMQ - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Prometheus and Grafana integration
Start RabbitMQ
↓
Enable Prometheus Plugin
↓
Prometheus Scrapes Metrics
↓
Store Metrics in Prometheus DB
↓
Grafana Queries Prometheus
↓
Visualize Metrics on Grafana Dashboard
This flow shows how RabbitMQ exposes metrics, Prometheus collects them, and Grafana visualizes the data.
Execution Sample
RabbitMQ
rabbitmq-plugins enable rabbitmq_prometheus

# Prometheus config snippet
scrape_configs:
  - job_name: 'rabbitmq'
    static_configs:
      - targets: ['localhost:15692']

# Grafana datasource setup points to Prometheus URL
This code enables Prometheus metrics in RabbitMQ, configures Prometheus to scrape those metrics, and sets Grafana to use Prometheus as a data source.
Process Table
StepActionCommand/ConfigResult/Output
1Enable Prometheus plugin in RabbitMQrabbitmq-plugins enable rabbitmq_prometheusPlugin enabled, metrics endpoint available at localhost:15692/metrics
2Configure Prometheus to scrape RabbitMQ metricsscrape_configs: - job_name: 'rabbitmq' static_configs: - targets: ['localhost:15692']Prometheus scrape job for RabbitMQ configured
3Start Prometheus serverprometheus --config.file=prometheus.ymlPrometheus collects and stores RabbitMQ metrics
4Add Prometheus as data source in GrafanaGrafana UI: Add data source -> Prometheus URLGrafana connects to Prometheus successfully
5Create Grafana dashboard with RabbitMQ metricsUse PromQL queries like rabbitmq_queue_messagesDashboard shows live RabbitMQ metrics graphs
6ExitN/AIntegration complete, metrics visible in Grafana
💡 All components running and connected, metrics flow from RabbitMQ to Grafana
Status Tracker
ComponentInitial StateAfter Step 1After Step 2After Step 3After Step 4After Step 5Final State
RabbitMQNo Prometheus metricsPrometheus plugin enabledMetrics endpoint activeMetrics exposedMetrics exposedMetrics exposedMetrics exposed
PrometheusNot scraping RabbitMQNot scrapingScraping configuredCollecting metricsCollecting metricsCollecting metricsCollecting metrics
GrafanaNo data sourceNo data sourceNo data sourceNo data sourcePrometheus data source addedDashboard createdDashboard showing metrics
Key Moments - 3 Insights
Why do we need to enable the Prometheus plugin in RabbitMQ?
Without enabling the plugin (Step 1 in execution_table), RabbitMQ does not expose metrics in a format Prometheus can scrape.
What happens if Prometheus is not configured to scrape the RabbitMQ metrics endpoint?
If Prometheus is not configured (Step 2), it will not collect any RabbitMQ metrics, so Grafana will have no data to display.
How does Grafana get the RabbitMQ metrics data?
Grafana queries Prometheus (Step 4 and 5), which stores the metrics scraped from RabbitMQ, to visualize the data.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does Prometheus start collecting RabbitMQ metrics?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Check the 'Result/Output' column for when Prometheus collects and stores metrics.
According to the variable tracker, what is the state of Grafana after Step 3?
APrometheus data source added
BNo data source
CDashboard created
DMetrics exposed
💡 Hint
Look at the Grafana row under 'After Step 3' in variable_tracker.
If the RabbitMQ Prometheus plugin is not enabled, what will be the impact on the integration?
ANo metrics endpoint available for Prometheus to scrape
BGrafana will show metrics without Prometheus
CPrometheus will scrape metrics normally
DRabbitMQ will send metrics directly to Grafana
💡 Hint
Refer to Step 1 in execution_table and the key moments about enabling the plugin.
Concept Snapshot
Enable RabbitMQ Prometheus plugin to expose metrics
Configure Prometheus to scrape RabbitMQ metrics endpoint
Start Prometheus to collect and store metrics
Add Prometheus as data source in Grafana
Create dashboards in Grafana to visualize RabbitMQ metrics
Metrics flow: RabbitMQ -> Prometheus -> Grafana
Full Transcript
This visual execution shows how to integrate Prometheus and Grafana with RabbitMQ. First, enable the Prometheus plugin in RabbitMQ to expose metrics. Then configure Prometheus to scrape these metrics from the RabbitMQ endpoint. Start Prometheus to collect and store the data. Next, add Prometheus as a data source in Grafana. Finally, create dashboards in Grafana to visualize the live RabbitMQ metrics. The execution table traces each step with commands and results. The variable tracker shows the state changes of RabbitMQ, Prometheus, and Grafana components. Key moments clarify common confusions about enabling the plugin and data flow. The quiz tests understanding of when metrics collection starts, Grafana state, and the importance of the plugin. This integration enables monitoring RabbitMQ performance visually and in real time.

Practice

(1/5)
1. What is the first step to enable monitoring of RabbitMQ metrics using Prometheus?
easy
A. Configure Prometheus scrape interval
B. Enable the RabbitMQ Prometheus plugin
C. Install Grafana dashboard
D. Restart the RabbitMQ server

Solution

  1. Step 1: Enable RabbitMQ Prometheus plugin

    This plugin exposes RabbitMQ metrics in a format Prometheus can scrape.
  2. Step 2: Confirm plugin activation

    Use rabbitmq-plugins enable rabbitmq_prometheus to activate it.
  3. Final Answer:

    Enable the RabbitMQ Prometheus plugin -> Option B
  4. Quick Check:

    Enable plugin = C [OK]
Hint: Start by enabling the Prometheus plugin in RabbitMQ [OK]
Common Mistakes:
  • Trying to configure Prometheus before enabling the plugin
  • Assuming Grafana setup is the first step
  • Restarting RabbitMQ without enabling the plugin
2. Which of the following is the correct Prometheus scrape configuration snippet to monitor RabbitMQ metrics?
easy
A. scrape_configs: - job_name: 'rabbitmq' static_configs: - targets: ['localhost:15692']
B. scrape_configs: - job_name: 'rabbitmq' static_configs: - targets: ['localhost:5672']
C. scrape_configs: - job_name: 'rabbitmq' static_configs: - targets: ['localhost:15672']
D. scrape_configs: - job_name: 'rabbitmq' static_configs: - targets: ['localhost:9090']

Solution

  1. Step 1: Identify RabbitMQ Prometheus metrics port

    The Prometheus plugin exposes metrics on port 15692 by default.
  2. Step 2: Verify scrape target in Prometheus config

    The target must be localhost:15692 to scrape RabbitMQ metrics correctly.
  3. Final Answer:

    scrape_configs with target localhost:15692 -> Option A
  4. Quick Check:

    Port 15692 for Prometheus metrics = A [OK]
Hint: Use port 15692 for RabbitMQ Prometheus metrics scrape [OK]
Common Mistakes:
  • Using RabbitMQ AMQP port 5672 instead of metrics port
  • Using RabbitMQ management port 15672 incorrectly
  • Using Prometheus default port 9090 as target
3. Given this Prometheus scrape config snippet, what will be the result when Prometheus scrapes RabbitMQ metrics?
scrape_configs:
  - job_name: 'rabbitmq'
    static_configs:
      - targets: ['rabbitmq-server:15692']
medium
A. Prometheus will fail due to wrong port
B. Prometheus will ignore this job
C. Prometheus will collect metrics but with errors
D. Prometheus will collect RabbitMQ metrics successfully

Solution

  1. Step 1: Check target hostname and port

    The target rabbitmq-server:15692 is valid if DNS resolves and port 15692 is open.
  2. Step 2: Confirm Prometheus plugin exposes metrics on port 15692

    This matches the default port for RabbitMQ Prometheus plugin metrics.
  3. Final Answer:

    Prometheus will collect RabbitMQ metrics successfully -> Option D
  4. Quick Check:

    Correct hostname and port = B [OK]
Hint: Correct hostname and port means successful scrape [OK]
Common Mistakes:
  • Assuming port 15692 is incorrect
  • Ignoring hostname resolution issues
  • Confusing management port with metrics port
4. You configured Prometheus to scrape RabbitMQ metrics but see no data in Grafana dashboards. What is the most likely cause?
medium
A. Prometheus scrape interval is too long
B. Grafana is not installed
C. RabbitMQ Prometheus plugin is not enabled
D. RabbitMQ server is down

Solution

  1. Step 1: Check if RabbitMQ Prometheus plugin is enabled

    If the plugin is disabled, no metrics are exposed for Prometheus to scrape.
  2. Step 2: Confirm plugin activation with rabbitmq-plugins list

    This command shows enabled plugins; absence of rabbitmq_prometheus means no metrics.
  3. Final Answer:

    RabbitMQ Prometheus plugin is not enabled -> Option C
  4. Quick Check:

    Plugin disabled = no metrics = A [OK]
Hint: Check plugin enabled before blaming Grafana or Prometheus [OK]
Common Mistakes:
  • Assuming Grafana installation causes no data
  • Blaming scrape interval without checking metrics exposure
  • Ignoring RabbitMQ server status
5. You want to create a Grafana dashboard to monitor RabbitMQ queue length over time. Which data source and query setup is correct?
hard
A. Use Prometheus data source; query rabbitmq_queue_messages_ready
B. Use RabbitMQ data source; query queue_length
C. Use Prometheus data source; query rabbitmq_queue_consumers
D. Use Grafana Loki data source; query queue_length_logs

Solution

  1. Step 1: Identify correct data source for RabbitMQ metrics

    Prometheus is used to collect and store RabbitMQ metrics exposed by the plugin.
  2. Step 2: Select the metric for queue length

    rabbitmq_queue_messages_ready represents the number of messages ready in queues.
  3. Final Answer:

    Use Prometheus data source; query rabbitmq_queue_messages_ready -> Option A
  4. Quick Check:

    Prometheus + rabbitmq_queue_messages_ready = D [OK]
Hint: Use Prometheus and metric rabbitmq_queue_messages_ready for queue length [OK]
Common Mistakes:
  • Using RabbitMQ data source which is not standard for Grafana
  • Querying consumers count instead of queue length
  • Using Loki which is for logs, not metrics
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard