2016-01-17 17:57:49 +00:00
|
|
|
# RabbitMQ Scraping
|
|
|
|
|
2016-01-23 18:38:24 +00:00
|
|
|
This is an example on how to setup RabbitMQ so Prometheus can scrape data from it.
|
2016-01-17 17:57:49 +00:00
|
|
|
It uses a third party [RabbitMQ exporter](https://github.com/kbudde/rabbitmq_exporter).
|
|
|
|
|
|
|
|
Since the [RabbitMQ exporter](https://github.com/kbudde/rabbitmq_exporter) needs to
|
2016-02-08 01:00:10 +00:00
|
|
|
scrape the RabbitMQ management API to scrape data, and it defaults to localhost, it is
|
2016-01-17 17:57:49 +00:00
|
|
|
easier to simply embed the **kbudde/rabbitmq-exporter** on the same pod as RabbitMQ,
|
|
|
|
this way they share the same network.
|
|
|
|
|
2016-01-23 18:38:24 +00:00
|
|
|
With this pod running you will have the exporter scraping data, but Prometheus has not
|
2016-01-17 17:57:49 +00:00
|
|
|
yet found the exporter and is not scraping data from it.
|
|
|
|
|
2016-01-23 18:38:24 +00:00
|
|
|
For more details on how to use Kubernetes service discovery take a look at the
|
2019-02-21 09:48:47 +00:00
|
|
|
[documentation](https://prometheus.io/docs/operating/configuration/#kubernetes-sd-configurations-kubernetes_sd_config)
|
2018-12-18 10:53:55 +00:00
|
|
|
and at the [available examples](./../).
|
2016-01-17 17:57:49 +00:00
|
|
|
|
2020-07-04 12:54:26 +00:00
|
|
|
After you have gotten Kubernetes service discovery up and running, add the following scrape_configs to prometheus.yml.
|
2016-01-17 17:57:49 +00:00
|
|
|
|
2020-05-27 10:34:05 +00:00
|
|
|
```
|
|
|
|
scrape_configs:
|
|
|
|
- job_name: 'RabbitMQ'
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
- role: pod
|
|
|
|
relabel_configs:
|
|
|
|
- source_labels:
|
|
|
|
- __meta_kubernetes_pod_label_app
|
|
|
|
regex: rabbitmq
|
|
|
|
action: keep
|
|
|
|
```
|
2016-01-17 17:57:49 +00:00
|
|
|
|
2016-01-23 18:38:24 +00:00
|
|
|
And you should be able to see your RabbitMQ exporter being scraped on the Prometheus status page.
|
|
|
|
Since the IP that will be scraped will be the pod endpoint it is important that the node
|
|
|
|
where Prometheus is running has access to the Kubernetes overlay network
|
|
|
|
(flannel, Weave, AWS, or any of the other options that Kubernetes gives to you).
|