mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #1314 from katcipis/master
Adding RabbitMQ deploy for kubernetes + prometheus integration
This commit is contained in:
commit
7f6acef4d5
28
documentation/examples/kubernetes-rabbitmq/README.md
Normal file
28
documentation/examples/kubernetes-rabbitmq/README.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# RabbitMQ Scraping
|
||||||
|
|
||||||
|
This is an example on how to setup RabbitMQ so Prometheus can scrape data from it.
|
||||||
|
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
|
||||||
|
scrape the RabbitMQ management API to scrap data, and it defaults to localhost, it is
|
||||||
|
easier to simply embed the **kbudde/rabbitmq-exporter** on the same pod as RabbitMQ,
|
||||||
|
this way they share the same network.
|
||||||
|
|
||||||
|
With this pod running you will have the exporter scraping data, but Prometheus has not
|
||||||
|
yet found the exporter and is not scraping data from it.
|
||||||
|
|
||||||
|
For more details on how to use Kubernetes service discovery take a look at the
|
||||||
|
[documentation](http://prometheus.io/docs/operating/configuration/#kubernetes-sd-configurations-kubernetes_sd_config)
|
||||||
|
and at the [available examples](./documentation/examples).
|
||||||
|
|
||||||
|
After you got Kubernetes service discovery up and running you just need to advertise that RabbitMQ
|
||||||
|
is exposing metrics. To do that you need to define a service that:
|
||||||
|
|
||||||
|
* Exposes the exporter port
|
||||||
|
* Has a **prometheus.io/scrape: "true"** annotation
|
||||||
|
* Has a **prometheus.io/port: "9090"** annotation
|
||||||
|
|
||||||
|
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).
|
27
documentation/examples/kubernetes-rabbitmq/rc.yml
Normal file
27
documentation/examples/kubernetes-rabbitmq/rc.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ReplicationController
|
||||||
|
metadata:
|
||||||
|
name: rabbitmq
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
app: rabbitmq
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: rabbitmq
|
||||||
|
labels:
|
||||||
|
app: rabbitmq
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: rabbitmq:3.5.4-management
|
||||||
|
name: rabbitmq
|
||||||
|
ports:
|
||||||
|
- containerPort: 5672
|
||||||
|
name: service
|
||||||
|
- containerPort: 15672
|
||||||
|
name: management
|
||||||
|
- image: kbudde/rabbitmq-exporter
|
||||||
|
name: rabbitmq-exporter
|
||||||
|
ports:
|
||||||
|
- containerPort: 9090
|
||||||
|
name: exporter
|
17
documentation/examples/kubernetes-rabbitmq/svc.yml
Normal file
17
documentation/examples/kubernetes-rabbitmq/svc.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: rabbitmq
|
||||||
|
labels:
|
||||||
|
name: rabbitmq
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: "9090"
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 9090
|
||||||
|
name: exporter
|
||||||
|
targetPort: exporter
|
||||||
|
protocol: TCP
|
||||||
|
selector:
|
||||||
|
app: rabbitmq
|
Loading…
Reference in a new issue