version: '3.2'
+
services:
+
zookeeper:
image: bitnami/zookeeper:latest
environment:
command: --kafka.server kafka:9092
ports:
- 9308:9308
+
+ prometheus:
+ image: prom/prometheus
+ ports:
+ - "9090:9090"
+ volumes:
+ - ./prometheus.yml:/etc/prometheus/prometheus.yml
--- /dev/null
+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}'