|
| 1 | +# Monitoring (JMX/Prometheus/Grafana) |
| 2 | +In this example, we deploy an RBAC enabled Confluent cluster with Prometheus/Grafana integration. |
| 3 | + |
| 4 | +## Deploy Stack |
| 5 | +From within this present directory(./examples/monitoring), run the following command: |
| 6 | + |
| 7 | +```shell |
| 8 | +kubectl apply -k ../../kustomize/crds && sleep 1 && kubectl apply -k . |
| 9 | +``` |
| 10 | + |
| 11 | +Once all the the pods are in a 'Running' status, we can start to investigate the rest of the stack. |
| 12 | + |
| 13 | +## Prometheus |
| 14 | +Prometheus has a UI you can view by forwarding port 9090 with the following command, and then accessing `http://127.0.0.1:9090` from a local browser. |
| 15 | +```shell |
| 16 | +kubectl port-forward \ |
| 17 | +$(kubectl get pods -n sandbox -l app=prometheus -l component=server -o name) \ |
| 18 | +9090 --namespace sandbox |
| 19 | +``` |
| 20 | + |
| 21 | +If you navigate to `http://localhost:9090/targets` you should hopefully see a screen such as this which indicates that Prometheus is successfully scraping from the Confluent Services |
| 22 | +0 |
| 23 | + |
| 24 | +The configuration file for Prometheus can be found at `./examples/monitoring/prometheus/server/cm.yaml` |
| 25 | + |
| 26 | +## Grafana |
| 27 | +Grafana's Web UI runs on port 3000. Similar to Prometheus, forward that port to your local machines with the following command: |
| 28 | +```shell |
| 29 | +kubectl port-forward \ |
| 30 | +$(kubectl get pods -n sandbox kubectl get pods -n sandbox -l app.kubernetes.io/component=grafana -o name) \ |
| 31 | +3000 --namespace sandbox |
| 32 | +``` |
| 33 | + |
| 34 | +Navigate to http://localhost:3000 |
| 35 | + |
| 36 | +You will need to login with the username 'admin' and the password 'password'. At the home screen you will see a dashboard called 'Confluent Platform'. Click on this |
| 37 | + |
| 38 | + |
| 39 | +This dashboard will display various metrics/alerts for the various Confluent services. This dashboard has been captured in code, and can be edited at `./examples/grafana/dashboards.yaml` |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +``` |
| 46 | +curl -X POST "http://localhost:5601/api/index_patterns/index_pattern" -H "Content-Type:application/json" -H 'kbn-xsrf:true' -d'{"index_pattern": {"title": "hello"}}' |
| 47 | +
|
| 48 | +
|
| 49 | +curl -X POST "http://localhost:5601/api/index_patterns/default" -H "Content-Type:application/json" -H 'kbn-xsrf:true' -d'{"index_pattern_id": "logstash*","force": true}' |
| 50 | +
|
| 51 | +
|
| 52 | +curl -X GET "http://localhost:5601/api/index_patterns/1" -H "Content-Type:application/json" -H 'kbn-xsrf:true' |
| 53 | +
|
| 54 | +curl -X GET "http://localhost:5601/api/index_patterns/log*" -H "Content-Type:application/json" -H 'kbn-xsrf:true' |
| 55 | +curl -X GET "http://localhost:5601/api/index_patterns/log" -H "Content-Type:application/json" -H 'kbn-xsrf:true' |
| 56 | +
|
| 57 | +
|
| 58 | +curl -X GET "http://localhost:5601/api/index_patterns" -H "Content-Type:application/json" -H 'kbn-xsrf:true' |
| 59 | +``` |
0 commit comments