Jerome Reinländer
Jerome Reinländer

Reputation: 1257

How to query rabbitmq_exporter

I am trying to use a rather popular Docker image with from my understanding uses Prometheus to scrape data from RabbitMQ. This assumption seems confirmed as the /metrics endpoint gives me exactly the data I would expect from Prometheus in this context.

My problem is that the usual queries to Prometheus yield unexpected results. If I query /api/v1/query?query=rabbitmq_queue_memory for example, I would expect to receive data about the queue memory. Building requests like this works according to the Prometheus documentation and also works on a plain Prometheus server. The field also does exist. However all I receive is a reponse status code of 200 with a html body:

<html>

<head>
    <title>RabbitMQ Exporter</title>
</head>

<body>
    <h1>RabbitMQ Exporter</h1>
    <p><a href='/metrics'>Metrics</a></p>
</body>

</html>

It also does not matter if I actually make a correct query. The same result appears for /apasdfasdfasfsi/v1/query?query=rabbitmq_queue_memory

Any ideas how to properly query data here? Since this image is rather popular and I cannot find any related issues anywhere (except from myself), I assume it does work, but I am simply doing something wrong.

Upvotes: 0

Views: 850

Answers (1)

Alin S&#238;npălean
Alin S&#238;npălean

Reputation: 10084

It would look as if you're querying your RabbitMQ exporter rather than Prometheus. Don't know if you already have a Prometheus instance, so you may need to start one, point it to your exporter's /metrics and then query said Prometheus instance for /api/v1/query?query=rabbitmq_queue_memory.

All the exporter does is produce the /metrics output you see. Prometheus (properly configured) will then scrape that endpoint periodically, build timeseries for each metric (from the value of each metric across time) and you can query Prometheus for said timeseries or aggregations thereof.

Upvotes: 2

Related Questions