From: Kai Moritz Date: Sun, 19 Feb 2023 09:42:41 +0000 (+0100) Subject: Added Prometheus X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=564d3b789b991bddef9ed5a7cd652c82f1e4d45b;p=demos%2Fkafka%2Fmonitoring Added Prometheus --- diff --git a/docker-compose.yml b/docker-compose.yml index 056be3c..28636a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 index 0000000..4441fdf --- /dev/null +++ b/prometheus.yml @@ -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}'