Added Prometheus
authorKai Moritz <kai@juplo.de>
Sun, 19 Feb 2023 09:42:41 +0000 (10:42 +0100)
committerKai Moritz <kai@juplo.de>
Tue, 21 Feb 2023 22:13:58 +0000 (23:13 +0100)
docker-compose.yml
prometheus.yml [new file with mode: 0644]

index 056be3c..28636a7 100644 (file)
@@ -1,5 +1,7 @@
 version: '3.2'
+
 services:
+
   zookeeper:
     image: bitnami/zookeeper:latest
     environment:
@@ -66,3 +68,10 @@ services:
     command: --kafka.server kafka:9092
     ports:
       - 9308:9308
+
+  prometheus:
+    image: prom/prometheus
+    ports:
+      - "9090:9090"
+    volumes:
+      - ./prometheus.yml:/etc/prometheus/prometheus.yml
diff --git a/prometheus.yml b/prometheus.yml
new file mode 100644 (file)
index 0000000..4441fdf
--- /dev/null
@@ -0,0 +1,54 @@
+global:
+  # How frequently to scrape targets by default.
+  # Default 15s
+  scrape_interval: 5s
+  # How frequently to evaluate rules.
+  # Default 15s
+  evaluation_interval: 5s
+  # How long until a scrape request times out.
+  # Default to 10s.
+  # Required because cp-demo is using cpu throttling, so let's leave enough time to fetch the metrics in particular for the first time as it needs to compile all rexps
+  scrape_timeout: 5s
+
+rule_files:
+  - "alert.rules"
+
+alerting:
+  alertmanagers:
+    - scheme: http
+      static_configs:
+        - targets:
+            - "alertmanager:9093"
+
+scrape_configs:
+  - job_name: "prometheus"
+    static_configs:
+      - targets: ["localhost:9090"]
+
+
+  - job_name: "zookeeper"
+    static_configs:
+      - targets:
+          - "zookeeper:1234"
+        labels:
+          env: "dev"
+    relabel_configs:
+      - source_labels: [__address__]
+        target_label: hostname
+        regex: '([^:]+)(:[0-9]+)?'
+        replacement: '${1}'
+
+
+  - job_name: "kafka-broker"
+    static_configs:
+      - targets:
+          - "kafka-1:80"
+          - "kafka-2:80"
+          - "kafka-3:80"
+        labels:
+          env: "dev"
+    relabel_configs:
+      - source_labels: [__address__]
+        target_label: hostname
+        regex: '([^:]+)(:[0-9]+)?'
+        replacement: '${1}'