Custom Monitoring for Java App

Custom monitoring based on Prometheus

Kato has added a custom business monitoring function since V5.3, and supports users to implement custom business monitoring based on Prometheus through a custom Exporter plug-in. This operation requires users to have a systematic understanding of the Prometheus monitoring system.

For users whose main development language is JAVA, we have integrated jmx_exporter into the source code construction process, and through the following simple operations, you can Implement custom JVM monitoring.

Prerequisites

  • Kato version is V5.3 and above

  • Projects built from JAVA source code

Enable jmx_exporter Custom Monitoring

Enable Monitoring

The switch turned on by jmx_exporter is to add a specified environment variable ES_ENABLE_JMX_EXPORTER = true for the JAVA service component

Add a 5556 port for the JAVA service component, which is the port that jmx_exporter listens to by default.

Add Monitoring Point

By clicking on the Management Monitoring Point at the top right of the business monitoring panel, you can define monitoring point information, which defines the source of monitoring indicators.

Click Add Configuration This group of configurations contains the following elements, which are required:

  • Configuration name: customize the name of this group of configurations

  • Collection task name: custom

  • Path: /metrics

  • Port: 5556

  • Collection time interval: 10s

After finishing these operations, update the JAVA service component to make it effective.

Add Monitoring Chart

Next, you can add a monitoring chart to display the JVM indicator rows in the JAVA service component:

Click Add Chart at the top of the business monitoring panel

After entering the new title and the corresponding query condition jvm_memory_bytes_used, click Query. If the graph is returned normally, the query conditions are correct. The definition of the title should be as clear as possible, and the unit should be clarified if necessary.

More Advanced Operations

By setting the following set of environment variables, you can define more advanced settings for jmx_exporter:

Environment Variable NameOptional ValueDescription
JMX_EXPORTER_AGENT_VERSION0.15.0jmx_exporter version, currently the latest stable version
JMX_EXPORTER_HTTP_PORT5556 (default)jmx_exporter listening port, customizable
JMX_EXPORTER_CONFIG/app/.jmx-exporter/config.yaml (default)jmx_exporter configuration file path, after the path can be customized, the customized configuration file will take effect after mounting