From 3ab9938d85b4119354ec10de9ed572da1570af0b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sun, 25 Jun 2017 15:34:31 +0200 Subject: Adds metrics exporter for Prometheus --- 50kafka.yml | 10 ++++++++++ README.md | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/50kafka.yml b/50kafka.yml index c99630b..1dd4804 100644 --- a/50kafka.yml +++ b/50kafka.yml @@ -10,11 +10,21 @@ spec: metadata: labels: app: kafka + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "5556" spec: terminationGracePeriodSeconds: 10 containers: + - name: metrics + image: solsson/kafka-prometheus-jmx-exporter + ports: + - containerPort: 5556 - name: broker image: solsson/kafka:0.11.0.0-rc2@sha256:c1316e0131f4ec83bc645ca2141e4fda94e0d28f4fb5f836e15e37a5e054bdf1 + env: + - name: JMX_PORT + value: "5555" ports: - containerPort: 9092 command: diff --git a/README.md b/README.md index 13d6032..5b9dbad 100644 --- a/README.md +++ b/README.md @@ -78,3 +78,11 @@ Testing and retesting... delete the namespace. PVs are outside namespaces so del kubectl delete namespace kafka rm -R ./data/ && kubectl -n kafka delete pv datadir-kafka-0 datadir-kafka-1 datadir-kafka-2 ``` + +## Metrics, Prometheus style + +Is the metrics system up and running? +``` +kubectl logs -c metrics kafka-0 +kubectl exec -c broker kafka-0 -- /bin/sh -c 'apk add --no-cache curl && curl http://localhost:5556/metrics' +``` -- cgit v1.2.3