The Grafana dashboard docker image is available at Docker Hub.
To use this dashboard image, provide the following environment variables:
http://<prometheus-host>:9090
.To display the metrics correctly with this dashboard, configure your Prometheus server to collect metrics from Pulsar correctly.
Attach your prometheus service to an extra label - cluster
. The cluster name is aligned with the PULSAR_CLUSTER
name you have provided to the grafana dashboard.
global:
...
external_labels:
cluster: <your-cluster-name>
Make sure the job name of each component is the same with the ones in this dashboard.
How to configure your prometheus server to collect the metrics of a Pulsar cluster, refer to example prometheus config.
Use this Grafana Dashboard on a standalone cluster.
Download the pulsar binary and follow the instruction to start a standalone cluster on your computer.
Two options are available to generate a prometheus config file.
{{ STANDALONE_HOST }}
with your IP address of the machine running pulsar standalone.
$ STANDALONE_HOST="$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{ print $2 }')" j2 prometheus/standalone.yml.template > /tmp/standalone.prometheus.yml
In Ubuntu, set STANDALONE_HOST
as below.
$ STANDALONE_HOST="$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{ print $2 }' | awk -F ':' '{ print $2 }' | awk 'NR==2')" j2 prometheus/standalone.yml.template > /tmp/standalone.prometheus.yml
If it doesn't work properly, you can set the IP manually.
docker run -p 9090:9090 -v /tmp/standalone.prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
After running the prometheus successfully, you have access to http://localhost:9090/targets, where you can see prometheus detecting all pulsar components, shown as follows.
When you have a Pulsar standalone and a Prometheus server connecting to the Pulsar standalone, you can start with the Grafana Dashboard.
export PULSAR_PROMETHEUS_URL=http://$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{ print $2 }'):9090
export PULSAR_CLUSTER=standalone
docker run -it -p 3000:3000 -e PULSAR_PROMETHEUS_URL="${PULSAR_PROMETHEUS_URL}" -e PULSAR_CLUSTER="${PULSAR_CLUSTER}" streamnative/apache-pulsar-grafana-dashboard:latest
In Ubuntu, set PULSAR_PROMETHEUS_URL
in this way.
export PULSAR_PROMETHEUS_URL=http://$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{ print $2 }' | awk -F ':' '{ print $2 }' | awk 'NR==2'):9090
If it doesn't work properly, you can set the IP manually.
Access the Grafana Dashboard at http://localhost:3000.
The default user name is admin
, the default password is happypulsaring
, and they are set in the conf/grafana.ini file.
First of all, you need to make sure your prometheus is configured to attach
cluster
label as described in section #prometheus.
If you already have a grafana installation and you would like to import the dashboards to your grafana installation.
You can run scripts/generate_dashboards.sh to generate a datasource and the dashboard files that you can use to import to your installation.
./scripts/generate_dashboards.sh <prometheus-url> <clustername>
<prometheus-url>
: The url points to your prometheus servcie. E.g. http://localhost:9090
<clustername>
: Your pulsar cluster name.The datasource yaml file and dashboard json files will be generated under target/datasources
and target/dashboards
.
You can then import those files into your grafana installation.
The Grafana Docker Image contains the following built-in dashboards for different components in an Apache Pulsar cluster. These dashboards are:
System metrics are rendered in the Node Metrics dashboard and some portions in Overview dashboard. The system metrics used by these dashboards are collected by Prometheus Node Exporter. So you have to configure each pulsar machine to run node exporter, and configure your Prometheus to scrape the metrics from node exporters.
To customize and build your own dashboard image, issue the following command:
make
Checkout Makefile for the details of the command used for building the docker image.