Skip to content

Plugin GenericJMX Config

Florian Forster edited this page Nov 21, 2023 · 1 revision

This page contains some example configurations for the GenericJMX plugin. This page is meant as a cookbook, so if you have a configuration for an aspect not handled here or a daemon not present, please feel free to add anything that's useful for you.

These definitions are also available in the source code distribution as contrib/GenericJMX.conf.

Generic

These values are provided by the Java Virtual Machine (JVM) itself and are therefore available for all Java processes (if enabled at startup).

Classes

Number of classes loaded by the JVM.

 <MBean "classes">
   ObjectName "java.lang:type=ClassLoading"
   #InstancePrefix ""
   #InstanceFrom ""

   <Value>
     Type "gauge"
     InstancePrefix "loaded_classes"
     #InstanceFrom ""
     Table false
     Attribute "LoadedClassCount"
   </Value>
 </MBean>

Compilation

Time spent by the JVM compiling or optimizing.

 <MBean "compilation">
   ObjectName "java.lang:type=Compilation"
   #InstancePrefix ""
   #InstanceFrom ""

   <Value>
     Type "total_time_in_ms"
     InstancePrefix "compilation_time"
     #InstanceFrom ""
     Table false
     Attribute "TotalCompilationTime"
   </Value>
 </MBean>

Garbage collector

Garbage collector information

 <MBean "garbage_collector">
   ObjectName "java.lang:type=GarbageCollector,*"
   InstancePrefix "gc-"
   InstanceFrom "name"

   <Value>
     Type "invocations"
     #InstancePrefix ""
     #InstanceFrom ""
     Table false
     Attribute "CollectionCount"
   </Value>

   <Value>
     Type "total_time_in_ms"
     InstancePrefix "collection_time"
     #InstanceFrom ""
     Table false
     Attribute "CollectionTime"
   </Value>

 # # Not that useful, therefore commented out.
 # <Value>
 #   Type "threads"
 #   #InstancePrefix ""
 #   #InstanceFrom ""
 #   Table false
 #   # Demonstration how to access composite types
 #   Attribute "LastGcInfo.GcThreadCount"
 # </Value>
 </MBean>

Memory

Generic heap / nonheap memory usage.

 # Heap memory usage
 <MBean "memory-heap">
   ObjectName "java.lang:type=Memory"
   #InstanceFrom ""
   InstancePrefix "memory-heap"

   # Creates four values: committed, init, max, used
   <Value>
     Type "jmx_memory"
     #InstancePrefix ""
     #InstanceFrom ""
     Table true
     Attribute "HeapMemoryUsage"
   </Value>
 </MBean>

 # Non-heap memory usage
 <MBean "memory-nonheap">
   ObjectName "java.lang:type=Memory"
   #InstanceFrom ""
   InstancePrefix "memory-nonheap"

   # Creates four values: committed, init, max, used
   <Value>
     Type "jmx_memory"
     #InstancePrefix ""
     #InstanceFrom ""
     Table true
     Attribute "NonHeapMemoryUsage"
   </Value>
 </MBean>

This config uses the jmx_memory data-set which is not defined by the default types.db shipped with collectd. To use this config, add the following to your custom types.db. See types.db(5) for details.

jmx_memory      value:GAUGE:0:U

Memory pools

Memory usage by memory pool.

 <MBean "memory_pool">
   ObjectName "java.lang:type=MemoryPool,*"
   InstancePrefix "memory_pool-"
   InstanceFrom "name"

   <Value>
     Type "jmx_memory"
     #InstancePrefix ""
     #InstanceFrom ""
     Table true
     Attribute "Usage"
   </Value>
 </MBean>

This config uses the non-standard data-set jmx_memory. For more details, see the Memory section above.

Tomcat / Catalina

The following MBeans are provided by Tomcat, an application server by Apache.

Request processors (global)

Traffic, number of requests and time used for each request processor.

 <MBean "catalina/global_request_processor">
   ObjectName "Catalina:type=GlobalRequestProcessor,*"
   InstancePrefix "request_processor-"
   InstanceFrom "name"

   <Value>
     Type "io_octets"
     InstancePrefix "global"
     #InstanceFrom ""
     Table false
     Attribute "bytesReceived"
     Attribute "bytesSent"
   </Value>

   <Value>
     Type "total_requests"
     InstancePrefix "global"
     #InstanceFrom ""
     Table false
     Attribute "requestCount"
   </Value>

   <Value>
     Type "total_time_in_ms"
     InstancePrefix "global-processing"
     #InstanceFrom ""
     Table false
     Attribute "processingTime"
   </Value>
 </MBean>

Request processors (detail)

Traffic, number of requests and time used for each request processor. This is more detailed, I think it returns statistics for each thread or something. (Fixme)

 <MBean "catalina/detailed_request_processor">
   ObjectName "Catalina:type=RequestProcessor,*"
   InstancePrefix "request_processor-"
   InstanceFrom "worker"

   <Value>
     Type "io_octets"
     #InstancePrefix ""
     InstanceFrom "name"
     Table false
     Attribute "bytesReceived"
     Attribute "bytesSent"
   </Value>

   <Value>
     Type "total_requests"
     #InstancePrefix ""
     InstanceFrom "name"
     Table false
     Attribute "requestCount"
   </Value>

   <Value>
     Type "total_time_in_ms"
     InstancePrefix "processing-"
     InstanceFrom "name"
     Table false
     Attribute "processingTime"
   </Value>
 </MBean>

Thread pool

Total number of threads in each thread pool and the number of threads currently running.

 <MBean "catalina/thread_pool">
   ObjectName "Catalina:type=ThreadPool,*"
   InstancePrefix "request_processor-"
   InstanceFrom "name"

   <Value>
     Type "threads"
     InstancePrefix "total"
     #InstanceFrom ""
     Table false
     Attribute "currentThreadCount"
   </Value>

   <Value>
     Type "threads"
     InstancePrefix "running"
     #InstanceFrom ""
     Table false
     Attribute "currentThreadsBusy"
   </Value>
 </MBean>

See also

Clone this wiki locally