Prometheus Exporter
Hazelcast Management Center can expose the metrics collected from cluster members to Prometheus. This
feature can be turned on by setting the hazelcast.mc.prometheusExporter.enabled
system property to true
.
Prometheus can be configured to scrape Management Center in prometheus.yml
as follows:
scrape_configs:
- job_name: 'HZ MC'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:8080'] # replace this address with the network address of Hazelcast Management Center
After starting Prometheus with this configuration, all metrics will be exported to Prometheus with the hz_
prefix. The metrics
are also available via the member JMX API.
With the default configuration, Management Center exports all metrics reported by the cluster members. Since it can be overly
verbose for some usecases, the metrics can be filtered with the hazelcast.mc.prometheusExporter.filter.metrics.included
or the hazelcast.mc.prometheusExporter.filter.metrics.excluded
system properties, both being comma-separated lists of
metric names.
Example of starting Management Center with specifying the metrics exported to Prometheus:
java -jar -Dhazelcast.mc.prometheusExporter.enabled=true \
-Dhazelcast.mc.prometheusExporter.filter.metrics.included=hz_topic_totalReceivedMessages,hz_map_totalPutLatency \
-jar hazelcast-management-center-4.2021.02.jar
Example of starting Management Center with specifying the metrics to be excluded from the Prometheus export:
java -jar -Dhazelcast.mc.prometheusExporter.enabled=true \
-Dhazelcast.mc.prometheusExporter.filter.metrics.excluded=hz_os_systemLoadAverage,hz_memory_freeHeap \
-jar hazelcast-management-center-4.2021.02.jar
By default, Prometheus connects via the same IP and port as the Management Center web interface. It is possible to
override the port number using the -Dhazelcast.mc.prometheusExporter.port
system property. Let’s say you have
started Management Center as shown below:
java -jar -Dhazelcast.mc.prometheusExporter.enabled=true \
-Dhazelcast.mc.prometheusExporter.port=2222 \
-jar hazelcast-management-center-4.2021.02.jar
Then, the Prometheus endpoint will be available at http://localhost:2222/metrics
, which should be reflected by the
Prometheus configuration as below:
scrape_configs:
- job_name: 'HZ MC'
static_configs:
- targets: ['localhost:2222']
If you want to visualize the Prometheus metrics using Grafana, then you can start with this dashboard. |