File tree Expand file tree Collapse file tree 6 files changed +84
-1
lines changed Expand file tree Collapse file tree 6 files changed +84
-1
lines changed Original file line number Diff line number Diff line change @@ -2586,6 +2586,8 @@ scripts/tear-down-oauth.sh
2586
2586
This scenario will show how to set network bandwidth quotas on principal (user).
2587
2587
The scenario requires a listener with SASL_PLAIN authentication.
2588
2588
2589
+ Bootstrap will initialize a Prometheus server on port 9090 and a Grafana UI with Kafka Quota dashboard on port 3000.
2590
+
2589
2591
Start scenario:
2590
2592
2591
2593
[source,bash]
@@ -2617,6 +2619,12 @@ Run a consumer perf test and see how throttling applies:
2617
2619
docker exec broker kafka-consumer-perf-test --topic test --messages 1000000 --consumer.config /tmp/alice.properties --broker-list broker:9092
2618
2620
----
2619
2621
2622
+ You can visualize metrics using the Grafana dashboard for Kafka Quotas fetched from https://github.com/confluentinc/jmx-monitoring-stacks repository
2623
+
2624
+ Open Grafana UI at http://localhost:3000/d/cwWEgYqMz/kafka-quotas
2625
+
2626
+ image::images/quotas.png[Kafka Quotas Grafana]
2627
+
2620
2628
2621
2629
Teardown:
2622
2630
Original file line number Diff line number Diff line change
1
+ global :
2
+ # How frequently to scrape targets by default.
3
+ # Default 15s
4
+ scrape_interval : 60s
5
+ # How frequently to evaluate rules.
6
+ # Default 15s
7
+ evaluation_interval : 15s
8
+ # How long until a scrape request times out.
9
+ # Default to 10s.
10
+ # 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
11
+ scrape_timeout : 30s
12
+
13
+
14
+ scrape_configs :
15
+ - job_name : " prometheus"
16
+ static_configs :
17
+ - targets : ["localhost:9090"]
18
+
19
+
20
+ - job_name : " kafka-broker"
21
+ static_configs :
22
+ - targets :
23
+ - " broker:1234"
24
+ labels :
25
+ env : " dev"
26
+ relabel_configs :
27
+ - source_labels : [__address__]
28
+ target_label : hostname
29
+ regex : ' ([^:]+)(:[0-9]+)?'
30
+ replacement : ' ${1}'
Original file line number Diff line number Diff line change @@ -9,8 +9,12 @@ services:
9
9
container_name : broker
10
10
ports :
11
11
- " 9092:9092"
12
+ - " 9101:9101"
13
+ - " 1234:1234"
12
14
volumes :
13
15
- ./config/alice.properties:/tmp/alice.properties
16
+ - ./config/agent/jmx_prometheus_javaagent-0.18.0.jar:/tmp/jmx_prometheus_javaagent-0.18.0.jar
17
+ - ./config/agent/kafka_broker.yml:/tmp/kafka_broker.yml
14
18
environment :
15
19
KAFKA_NODE_ID : 1
16
20
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP : CONTROLLER:PLAINTEXT,AUTH:SASL_PLAINTEXT
@@ -35,4 +39,27 @@ services:
35
39
password="admin-secret" \
36
40
user_admin="admin-secret" \
37
41
user_alice="alice-secret";
38
- CLUSTER_ID : ' QTnB2tAgTWa1ec5wYon2jg'
42
+ CLUSTER_ID : ' QTnB2tAgTWa1ec5wYon2jg'
43
+ KAFKA_JMX_PORT : 9101
44
+ KAFKA_JMX_HOSTNAME : " localhost"
45
+ EXTRA_ARGS : -javaagent:/tmp/jmx_prometheus_javaagent-0.18.0.jar=1234:/tmp/kafka_broker.yml
46
+
47
+ prometheus :
48
+ image : prom/prometheus:v2.29.2
49
+ container_name : prometheus
50
+ ports :
51
+ - " 9090:9090"
52
+ volumes :
53
+ - ./config/prometheus/:/etc/prometheus
54
+
55
+ grafana :
56
+ image : grafana/grafana:8.1.3
57
+ container_name : grafana
58
+ environment :
59
+ - " GF_SECURITY_ADMIN_USER=admin"
60
+ - " GF_SECURITY_ADMIN_PASSWORD=password"
61
+ - " GF_USERS_ALLOW_SIGN_UP=false"
62
+ ports :
63
+ - " 3000:3000"
64
+ volumes :
65
+ - ./config/grafana/provisioning/:/etc/grafana/provisioning
Original file line number Diff line number Diff line change 2
2
3
3
sh scripts/tear-down.sh
4
4
5
+ echo " download jmx exporter files..."
6
+ mkdir -p quotas/config/agent
7
+
8
+ wget -P quotas/config/agent https://raw.githubusercontent.com/confluentinc/jmx-monitoring-stacks/7.2-post/shared-assets/jmx-exporter/kafka_broker.yml
9
+ wget -P quotas/config/agent https://github.com/confluentinc/jmx-monitoring-stacks/raw/7.2-post/shared-assets/jmx-exporter/jmx_prometheus_javaagent-0.18.0.jar
10
+
11
+ echo " download grafana files..."
12
+ mkdir -p quotas/config/grafana/provisioning/dashboards
13
+ mkdir -p quotas/config/grafana/provisioning/datasources
14
+
15
+ wget -P quotas/config/grafana/provisioning/datasources https://raw.githubusercontent.com/confluentinc/jmx-monitoring-stacks/7.2-post/jmxexporter-prometheus-grafana/assets/grafana/provisioning/datasources/datasource.yml
16
+ wget -P quotas/config/grafana/provisioning/dashboards https://raw.githubusercontent.com/confluentinc/jmx-monitoring-stacks/7.2-post/jmxexporter-prometheus-grafana/assets/grafana/provisioning/dashboards/dashboard.yml
17
+ wget -P quotas/config/grafana/provisioning/dashboards https://raw.githubusercontent.com/confluentinc/jmx-monitoring-stacks/7.2-post/jmxexporter-prometheus-grafana/assets/grafana/provisioning/dashboards/kafka-quotas.json
18
+
19
+
5
20
echo " Starting Kafka cluster..."
6
21
docker-compose -f quotas/docker-compose.yml --env-file .env up -d
Original file line number Diff line number Diff line change 2
2
3
3
echo " Stopping docker containers..."
4
4
docker-compose -f quotas/docker-compose.yml --env-file .env down --volumes
5
+
6
+ rm -Rf quotas/config/agent
7
+ rm -Rf quotas/config/grafana
You can’t perform that action at this time.
0 commit comments