Monitoring

You can use different ways to monitor a Pulsar cluster, exposing both metrics that relate to the usage of topics and the overall health of the individual components of the cluster.

指标采集

你能够采集 broker、Zookeeper、Bookeeper 的统计信息。

Borker 统计信息

You can collect Pulsar broker metrics from brokers and export the metrics in JSON format. The Pulsar broker metrics mainly have two types:

  • Destination dumps, which contain stats for each individual topic. You can fetch the destination dumps using the command below:

    1. bin/pulsar-admin broker-stats destinations
  • Broker metrics, which contain the broker information and topics stats aggregated at namespace level. You can fetch the broker metrics using the command below:

    1. bin/pulsar-admin broker-stats monitoring-metrics

All the message rates are updated every 1min.

The aggregated broker metrics are also exposed in the Prometheus format at:

  1. http://$BROKER_ADDRESS:8080/metrics

Zookeeper 统计信息

The local Zookeeper and configuration store server and clients that are shipped with Pulsar have been instrumented to expose detailed stats through Prometheus as well.

  1. http://$LOCAL_ZK_SERVER:8000/metrics
  2. http://$GLOBAL_ZK_SERVER:8001/metrics

本地 Zookeeper 集群的默认端口是8000,配置存储集群的默认端口是8001。 You can change the default port of local Zookeeper and configuration store by specifying system property stats_server_port.

Bookeeper 统计信息

For BookKeeper you can configure the stats frameworks by changing the statsProviderClass in conf/bookkeeper.conf.

The default BookKeeper configuration, which is included with Pulsar distribution, enables the Prometheus exporter.

  1. http://$BOOKIE_ADDRESS:8000/metrics

The default port for bookie is 8000 (instead of 8080). You can change the port by configuring prometheusStatsHttpPort in conf/bookkeeper.conf.

Prometheus 配置

You can use Prometheus to collect and store the metrics data. For details, refer to Prometheus guide.

When you run Pulsar on bare metal, you can provide the list of nodes that needs to be probed. When you deploy Pulsar in a Kubernetes cluster, the monitoring is automatically setup with the provided instructions.

监控面板

When you collect time series statistics, the major problem is to make sure the number of dimensions attached to the data does not explode.

For that reason you only need to collect time series of metrics aggregated at the namespace level.

Pulsar 主题维度监控面板

The per-topic dashboard instructions are available at Dashboard.

Grafana

You can use grafana to easily create dashboard driven by the data that is stored in Prometheus.

When you deploy Pulsar on Kubernetes, a pulsar-grafana Docker image is enabled by default. You can use the docker image with the principal dashboards.

Enter the command below to use the dashboard manually:

  1. docker run -p3000:3000 \
  2. -e PROMETHEUS_URL=http://$PROMETHEUS_HOST:9090/ \
  3. apachepulsar/pulsar-grafana:latest