5.3. Configuring the broker to collect JVM metrics
The following procedure shows how to configure the broker to collect Java Virtual Machine (JVM) metrics for Garbage Collection (GC), memory, and threads.
Prerequisites
- You have previously enabled the Prometheus metrics plugin in your broker configuration. For more information, see 第 5.2 节 “Enabling the Prometheus metrics plugin for AMQ Broker”.
Procedure
-
Open the
<broker_instance_dir>/etc/broker.xmlconfiguration file. In the
<metrics>element that you added to the configuration when enabling the Prometheus metrics plugin, specify whether the broker collects JVM metrics for Garbage Collection (GC), memory, and threads. For example:<metrics> <jvm-gc>true</jvm-gc> <jvm-memory>true</jvm-memory> <jvm-threads>true</jvm-threads> <plugin class-name="com.redhat.amq.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/> </metrics>注意If you do not explicitly add the
jvm-memoryparameter to your configuration and specify a value, the broker uses a default value oftrue. This means that the broker exports JVM memory metrics by default. The default values of thejvm-gcandjvm-threadsparameters arefalse.-
Save the
broker.xmlconfiguration file. The broker starts to gather the JVM metrics that you have enabled. These metrics are also exported to Prometheus format.