JVM Monitoring
NetXMS can monitor Java Virtual Machine (JVM) instances through JMX (Java Management Extensions). This enables monitoring of Java applications including heap usage, thread counts, class loading, and application-specific MBeans.
Overview
JVM monitoring provides visibility into:
-
Heap and non-heap memory usage
-
Thread count and state
-
Class loading statistics
-
Application-specific metrics exposed via JMX MBeans
Garbage collector statistics have no dedicated metrics; they can be read through the generic JMX.ObjectAttribute(…) metric against the java.lang:type=GarbageCollector,name=… MBeans.
Agent Configuration
The NetXMS agent uses a two-layer architecture for JMX monitoring:
the Java subagent (java.nsm) loads a JVM and bridges Java plugins into the agent,
and the JMX plugin (jmx.jar) provides the actual JMX monitoring capability.
SubAgent = java.nsm
[JAVA]
JVM = /usr/lib/jvm/java-17/lib/server/libjvm.so
Plugin = jmx.jar
[JMX]
Server = myapp:service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi
Server = tomcat:monitor/secret@service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi
Java subagent configuration ([JAVA] section):
| Parameter | Description |
|---|---|
|
Path to the JVM shared library ( |
|
Additional option for the JVM (e.g. |
|
Extra classpath entries. Can appear multiple times. |
|
Plugin to load, as a JAR file path or a class name. Can appear multiple times. Use |
JMX plugin configuration ([JMX] section):
Server entry format: name:url, name:login@url, or name:login/password@url
At least one Server entry must be defined; without it the JMX plugin fails to load with the error "JMX servers not defined".
| Component | Description |
|---|---|
|
Unique identifier for this JVM (used in metric names as the first argument) |
|
JMX service URL (e.g. |
|
JMX authentication user (optional, placed before |
|
JMX authentication password (optional, separated from login by |
Enabling JMX on Java Applications
The target Java application must have JMX enabled. Add these JVM options:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
For production with authentication:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=true
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=/path/to/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=/path/to/jmxremote.access
JVM Metrics
Memory
| Parameter | Description |
|---|---|
|
Current heap memory usage in bytes |
|
Committed heap memory in bytes |
|
Initial heap memory in bytes |
|
Maximum heap memory in bytes |
|
Non-heap memory usage in bytes |
|
Committed non-heap memory in bytes |
|
Initial non-heap memory in bytes |
|
Maximum non-heap memory in bytes |
|
Number of objects pending finalization |
Memory metrics are absolute values in bytes.
To monitor heap usage as a percentage, compute it from JMX.Memory.Heap.Current and JMX.Memory.Heap.Max in a DCI transformation script.
Threads
| Parameter | Description |
|---|---|
|
Current thread count |
|
Current daemon thread count |
|
Peak thread count since JVM start |
|
Total threads started since JVM start |
VM Information
| Parameter | Description |
|---|---|
|
JVM uptime in milliseconds |
|
JVM implementation name |
|
JVM version |
|
JVM vendor |
|
JVM specification version |
|
Boot class path |
|
Class path |
|
Currently loaded class count |
|
Total classes loaded since JVM start |
|
Total classes unloaded |
Discovery Lists
| List | Description |
|---|---|
|
All available MBean domains on the JVM |
|
MBean object names. Optional second argument filters by domain. |
|
Attribute names of a specific MBean. Second argument is the fully-qualified MBean object name. |
Custom MBean Monitoring
Any MBean exposed by the Java application can be queried:
JMX.ObjectAttribute(name,objectName,attributeName[,item])
The optional item argument is used when the attribute is a CompositeData type (e.g. HeapMemoryUsage has items committed, used, init, max).
Example — monitoring Tomcat thread pool:
JMX.ObjectAttribute(tomcat,'Catalina:type=ThreadPool,name="http-nio-8080"',currentThreadCount)
Example — monitoring ActiveMQ queue depth:
JMX.ObjectAttribute(activemq,'org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=myQueue',QueueSize)
| JMX ObjectNames contain commas, so the ObjectName must be enclosed in quotes to be treated as a single argument. |
Application servers such as Tomcat, WildFly/JBoss, or ActiveMQ expose their operational statistics as MBeans that can be read the same way.