Scrape your service RabbitMQ messages with Prometheus | Kubernetes

Sofiene Memmi
2 min readDec 8, 2019

After getting started with Prometheus in one of my projects, it was kind of difficult to get it up and running with every deployment or pod in Kubernetes. That’s why today we will talk about implementing Prometheus with RabbitMQ and scrapping a good amount of metrics about your services.

To start with, let’s have an idea about Prometheus for beginners…
Prometheus is a free software application used for event monitoring and alerting. It records real-time metrics in a time series database (allowing for high dimensionality) built using a HTTP pull model, with flexible queries and real-time alerting. The project is written in Go and licensed under the Apache 2 License, with source code available on GitHub, and is a graduated project of the Cloud Native Computing Foundation, along with Kubernetes and Envoy.” [Wikipedia]
So to make it easy, Prometheus is a powerful tool that makes us able to monitor our systems/applications and it stores the collected metrics in a time series database.

To start scrapping the RabbitMQ metrics we’ll need:
-Kubernetes cluster running with Kubectl setup
-Deployed RabbitMQ pod with a version higher or equal to ≥3,8

What we will do here is to enable the rabbitmq_prometheus plugin:

This will make the new /metrics endpoint discoverable under the port:15692 and it's possible for us from now to look at these metrics by the following command:

kubectl port-forward <rabbit-pod-name> 80:15692

Now on http://localhost:80/metrics we can find all of the scrapped details by the rabbitmq_prometheus plugin

Very good! But now our goal is to make those metrics discoverable by Prometheus and available on our Prometheus interface.
To make this happen we will add this endpoint to our scrape_configs in the Prometheus configuration file

After our Prometheus deployment now, when we look at our targets we’ll find rabbitMQ and we’ll be able to scrape the provided metrics

Last thing, to have a better overview of our RabbitMQ nodes and message rates we can use the provided Grafana dashboard from RabbitMQ on this link: https://grafana.com/grafana/dashboards/10991

And finally, I hope that you liked this tutorial. I will be happy to answer your questions if you find any difficulty.

--

--