Skip to main content

Monitoring Jetty Web Server

Collect and monitor general performance metrics of Jetty application server

Usage protocol: JMX

Pre-monitoring Operations

You need to enable the JMX service in the JVM application. HertzBeat uses the JMX protocol to collect metrics for the JVM.

Jetty application server opens JMX protocol steps

Refer to official documentation

  1. Start the JMX JMX-REMOTE module in Jetty
java -jar $JETTY_HOME/start.jar --add-module=jmx
java -jar $JETTY_HOME/start.jar --add-module=jmx-remote

Successful command execution will create ${JETTY_BASE}/start.d/jmx-remote.ini configuration file

  1. Edit the ${JETTY_BASE}/start.d/jmx-remote.ini configuration file to modify the JMX IP port and other parameters.

localhost needs to be modified to expose the IP

## The host/address to bind the RMI server to.
# jetty.jmxremote.rmiserverhost=localhost

## The port the RMI server listens to (0 means a random port is chosen).
# jetty.jmxremote.rmiserverport=1099

## The host/address to bind the RMI registry to.
# jetty.jmxremote.rmiregistryhost=localhost

## The port the RMI registry listens to.
# jetty.jmxremote.rmiregistryport=1099

## The host name exported in the RMI stub.
-Djava.rmi.server.hostname=localhost
  1. Restart Jetty Server.

Configuration parameter

Parameter nameParameter help description
Monitoring HostMonitored IPV4, IPV6 or domain name. Note⚠️Without protocol header (eg: https://, http://)
Monitoring nameIdentify the name of this monitoring. The name needs to be unique
PortPort provided by JMX
UsernameJMX connection user name, optional
PasswordJMX connection password, optional
Collection intervalInterval time of monitor periodic data collection, unit: second, and the minimum interval that can be set is 30 seconds
Whether to detectWhether to detect and check the availability of monitoring before adding monitoring. Adding and modifying operations will continue only after the detection is successful
Description remarksFor more information about identifying and describing this monitoring, users can note information here

Collection Metrics

Metrics Set:memory_pool

Metric nameMetric unitMetric help description
namemetrics name
committedkbtotal size
initkbinit size
maxkbmax size
usedkbused size

Metrics Set:class_loading

Metric nameMetric unitMetric help description
LoadedClassCountLoaded Class Count
TotalLoadedClassCountTotal Loaded Class Count
UnloadedClassCountUnloaded Class Count

Metrics Set:thread

Metric nameMetric unitMetric help description
TotalStartedThreadCountTotal Started Thread Count
ThreadCountThread Count
PeakThreadCountPeak Thread Count
DaemonThreadCountDaemon Thread Count
CurrentThreadUserTimemsCurrent Thread User Time
CurrentThreadCpuTimemsCurrent Thread Cpu Time