![]() ![]() The data can be displayed after it is collected. Regex: _meta_kubernetes_service_label_(.+) The annotations field added to the Service is to do some retagging of tags in the RawJobs of the Promethues profile, etc.Ĭonfigure Prometheus so that monitoring data can be collected. Path: /data/prometheus/jmx_exporter/jmx_prometheus_javaagent-0.15.0.jar mountPath: "/jmx_prometheus_javaagent-0.15.0.jar" Value: "-javaagent:/jmx_prometheus_javaagent-0.15.0.jar=8088:/jmx/prometheus-jmx-config.yaml" This example uses port 8088 to expose the JVM monitoring metrics, which you can change as needed.The startup parameter format: -javaagent:=:.The JVM will read the JAVA_OPTS environment variable as an additional startup parameter, which can be added to the application during deployment. When deploying an application to Kubernetes, you need to modify the JVM startup parameters to load the JMX Exporter on startup. pattern: 'java.lang((?!process_cpu_time)\w+):'įor more configuration items, please refer to the Prometheus official documentation. pattern: 'java.lang(committed_virtual_memory|free_physical_memory|free_swap_space|total_physical_memory|total_swap_space)_size:' Write the JMX Exporter configuration file prometheus-jmx-config.yaml. $ wget -O /data/prometheus/jmx_exporter/jmx_prometheus_javaagent-0.15.0.jar Execute the following command to download to the hostPath directory specified by the mount. Prepare the jar package file, you can go to the Github page of jmx_exporter to get the latest jar package download address. ![]() Preparing jar packages and configuration files Here for demonstration purposes, the jar package is simply mounted directly into the container using hostPath, and the configuration file is mounted into the container using the ConfigMap form. jar package is a binary file, which is not convenient to mount via ConfigMap, so it is recommended to package the JMX Exporter jar package and configuration file into the business container image directly. The JMX Exporter jar package and configuration file should be specified when starting the JVM using the in-process method. Steps Expose JVM monitoring metrics using JMX Exporter This article takes the JVM in-process startup (in-process) approach as an example, using JMX Exporter to expose JVM monitoring metrics in a Kubernetes environment. Officially, it is not recommended to use the start independent process approach, which is complex to configure and requires a separate process, and the monitoring of the process itself raises new issues. Specify the parameters when the JVM starts, run the JMX Exporter jar package as a javaagent, read the JVM runtime state data in-process, convert it to Prometheus metrics format, and expose the port for Prometheus to collect. JMX Exporter calls RMI to get JVM runtime state data, converts it to Prometheus metrics format, and exposes the port for Prometheus to collect. JMX Exporter provides two ways to expose JVM monitoring metrics, starting a standalone process and in-process (in-process) JVM. JMX Exporter uses Java’s JMX mechanism to read JVM runtime monitoring data and convert it to Prometheus-aware metrics format so that Prometheus can monitor and collect it. Java Management Extensions, JMX, is an extension framework for managing Java, and JMX Exporter is based on this framework for reading the runtime state of the JVM. ![]() Learn how to use Prometheus with JMX Exporter to monitor Java applications once your Java business has been containerized to Kubernetes in this article. The Prometheus community has developed the JMX Exporter to export JVM monitoring metrics for use with Prometheus to capture monitoring data. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |