From bb4722d6b51afacd43174a5ca972993680ad2a77 Mon Sep 17 00:00:00 2001 From: Tiago Katcipis Date: Tue, 12 Jan 2016 20:59:37 -0200 Subject: [PATCH 1/4] Adding RabbitMQ example as mentioned on #1312 --- .../contrib/kubernetes/rabbitmq/rc.yml | 27 +++++++++++++++++++ .../contrib/kubernetes/rabbitmq/svc.yml | 17 ++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 documentation/examples/contrib/kubernetes/rabbitmq/rc.yml create mode 100644 documentation/examples/contrib/kubernetes/rabbitmq/svc.yml diff --git a/documentation/examples/contrib/kubernetes/rabbitmq/rc.yml b/documentation/examples/contrib/kubernetes/rabbitmq/rc.yml new file mode 100644 index 000000000..b3ed2a40a --- /dev/null +++ b/documentation/examples/contrib/kubernetes/rabbitmq/rc.yml @@ -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 diff --git a/documentation/examples/contrib/kubernetes/rabbitmq/svc.yml b/documentation/examples/contrib/kubernetes/rabbitmq/svc.yml new file mode 100644 index 000000000..de98e269c --- /dev/null +++ b/documentation/examples/contrib/kubernetes/rabbitmq/svc.yml @@ -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 From 53fb6488491a99917cd7986563b8b25363c631bb Mon Sep 17 00:00:00 2001 From: Tiago Katcipis Date: Sun, 17 Jan 2016 15:57:49 -0200 Subject: [PATCH 2/4] adding README to explain the example --- .../contrib/kubernetes/rabbitmq/README.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 documentation/examples/contrib/kubernetes/rabbitmq/README.md diff --git a/documentation/examples/contrib/kubernetes/rabbitmq/README.md b/documentation/examples/contrib/kubernetes/rabbitmq/README.md new file mode 100644 index 000000000..c309a81ab --- /dev/null +++ b/documentation/examples/contrib/kubernetes/rabbitmq/README.md @@ -0,0 +1,28 @@ +# RabbitMQ Scraping + +This is an example on how to setup RabbitMQ so prometheus can scrap 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 +connect on 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 have 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 on the +[documentation](http://prometheus.io/docs/operating/configuration/#kubernetes-sd-configurations-kubernetes_sd_config) +and on 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 +* Add the annotation: prometheus.io/scrape: "true" +* Add the annotation: prometheus.io/port: "9090" + +And you should be able to see your RabbitMQ exporter being scrapped on prometheus status page. +Since the ip that will be scrapped will be the pod endpoint it is important that the node +where prometheus is running have access to the Kubernetes overlay network +(flannel, weave, aws, or any of the other options that Kubernetes gives to you). From b7ae20d3d8e68c0b21ade98f18acce3e9b35c61c Mon Sep 17 00:00:00 2001 From: Tiago Katcipis Date: Sun, 17 Jan 2016 21:35:51 -0200 Subject: [PATCH 3/4] fixing typos --- .../examples/contrib/kubernetes/rabbitmq/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/examples/contrib/kubernetes/rabbitmq/README.md b/documentation/examples/contrib/kubernetes/rabbitmq/README.md index c309a81ab..0a61fffff 100644 --- a/documentation/examples/contrib/kubernetes/rabbitmq/README.md +++ b/documentation/examples/contrib/kubernetes/rabbitmq/README.md @@ -1,6 +1,6 @@ # RabbitMQ Scraping -This is an example on how to setup RabbitMQ so prometheus can scrap data from it. +This is an example on how to setup RabbitMQ so Prometheus can scrap 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 @@ -8,7 +8,7 @@ connect on RabbitMQ management API to scrap data, and it defaults to localhost, 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 have not +With this pod running you will have the exporter scraping data, but Prometheus have 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 on the @@ -22,7 +22,7 @@ is exposing metrics. To do that you need to define a service that: * Add the annotation: prometheus.io/scrape: "true" * Add the annotation: prometheus.io/port: "9090" -And you should be able to see your RabbitMQ exporter being scrapped on prometheus status page. -Since the ip that will be scrapped will be the pod endpoint it is important that the node -where prometheus is running have access to the Kubernetes overlay network +And you should be able to see your RabbitMQ exporter being scraped on 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 have access to the Kubernetes overlay network (flannel, weave, aws, or any of the other options that Kubernetes gives to you). From 73be7f63bee5883739502208c0a4b14dfd07d514 Mon Sep 17 00:00:00 2001 From: Tiago Katcipis Date: Sat, 23 Jan 2016 16:38:24 -0200 Subject: [PATCH 4/4] Fix typos and moving example to the correct place --- .../README.md | 22 +++++++++---------- .../rabbitmq => kubernetes-rabbitmq}/rc.yml | 0 .../rabbitmq => kubernetes-rabbitmq}/svc.yml | 0 3 files changed, 11 insertions(+), 11 deletions(-) rename documentation/examples/{contrib/kubernetes/rabbitmq => kubernetes-rabbitmq}/README.md (61%) rename documentation/examples/{contrib/kubernetes/rabbitmq => kubernetes-rabbitmq}/rc.yml (100%) rename documentation/examples/{contrib/kubernetes/rabbitmq => kubernetes-rabbitmq}/svc.yml (100%) diff --git a/documentation/examples/contrib/kubernetes/rabbitmq/README.md b/documentation/examples/kubernetes-rabbitmq/README.md similarity index 61% rename from documentation/examples/contrib/kubernetes/rabbitmq/README.md rename to documentation/examples/kubernetes-rabbitmq/README.md index 0a61fffff..e3457759e 100644 --- a/documentation/examples/contrib/kubernetes/rabbitmq/README.md +++ b/documentation/examples/kubernetes-rabbitmq/README.md @@ -1,28 +1,28 @@ # RabbitMQ Scraping -This is an example on how to setup RabbitMQ so Prometheus can scrap data from it. +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 -connect on RabbitMQ management API to scrap data, and it defaults to localhost, it is +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 have not +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 on the +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 on the [available examples](./documentation/examples). +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 -* Add the annotation: prometheus.io/scrape: "true" -* Add the annotation: prometheus.io/port: "9090" +* 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 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 have access to the Kubernetes overlay network -(flannel, weave, aws, or any of the other options that Kubernetes gives to you). +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). diff --git a/documentation/examples/contrib/kubernetes/rabbitmq/rc.yml b/documentation/examples/kubernetes-rabbitmq/rc.yml similarity index 100% rename from documentation/examples/contrib/kubernetes/rabbitmq/rc.yml rename to documentation/examples/kubernetes-rabbitmq/rc.yml diff --git a/documentation/examples/contrib/kubernetes/rabbitmq/svc.yml b/documentation/examples/kubernetes-rabbitmq/svc.yml similarity index 100% rename from documentation/examples/contrib/kubernetes/rabbitmq/svc.yml rename to documentation/examples/kubernetes-rabbitmq/svc.yml