How to scape data of rabbitMQ in prometheus server

How to scape data of rabbitMQ in prometheus server

To enable Prometheus metrics in RabbitMQ, we need to enable the Prometheus plugin and expose the metrics endpoint. Here are the steps.

1️⃣ Enable the Prometheus Plugin in RabbitMQ

Run this command on the RabbitMQ server:

  1. rabbitmq-plugins enable rabbitmq_prometheus


This enables the rabbitmq_prometheus plugin which exposes metrics in Prometheus format.


2️⃣ Verify the Plugin is Enabled

Check installed plugins:

  1. rabbitmq-plugins list


You should see:

  1. [E*] rabbitmq_prometheus



3️⃣ Access the Metrics Endpoint

RabbitMQ exposes metrics at:

  1. http://<rabbitmq-host>:15692/metrics


If enabled correctly, you'll see Prometheus formatted metrics like:

  1. rabbitmq_queue_messages_ready
  2. rabbitmq_queue_messages_unacknowledged
  3. rabbitmq_connections


4️⃣ Configure Prometheus to Scrape RabbitMQ

Edit your Prometheus config (prometheus.yml):

  1. scrape_configs:
  2.   - job_name: 'rabbitmq'
  3.     static_configs:
  4.  - targets: ['localhost:15692']


Then restart Prometheus.

  1. sudo systemctl restart prometheus

Check status:

  1. sudo systemctl status prometheus