# Generic Java JMX ## Overview Official JMX Template from Zabbix distribution. Could be useful for many Java Applications (JMX). ## Requirements Zabbix version: 7.0 and higher. ## Tested versions This template has been tested on: - Java Applications ## Configuration > Zabbix should be configured according to the instructions in the [Templates out of the box](https://www.zabbix.com/documentation/7.0/manual/config/templates_out_of_the_box) section. ## Setup Refer to the vendor documentation. ### Macros used |Name|Description|Default| |----|-----------|-------| |{$JMX.NONHEAP.MEM.USAGE.MAX}|
A threshold in percent for Non-heap memory utilization trigger.
|`85`| |{$JMX.NONHEAP.MEM.USAGE.TIME}|The time during which the Non-heap memory utilization may exceed the threshold.
|`10m`| |{$JMX.HEAP.MEM.USAGE.MAX}|A threshold in percent for Heap memory utilization trigger.
|`85`| |{$JMX.HEAP.MEM.USAGE.TIME}|The time during which the Heap memory utilization may exceed the threshold.
|`10m`| |{$JMX.MP.USAGE.MAX}|A threshold in percent for memory pools utilization trigger. Use a context to change the threshold for a specific pool.
|`85`| |{$JMX.MP.USAGE.TIME}|The time during which the memory pools utilization may exceed the threshold.
|`10m`| |{$JMX.FILE.DESCRIPTORS.MAX}|A threshold in percent for file descriptors count trigger.
|`85`| |{$JMX.FILE.DESCRIPTORS.TIME}|The time during which the file descriptors count may exceed the threshold.
|`3m`| |{$JMX.CPU.LOAD.MAX}|A threshold in percent for CPU utilization trigger.
|`85`| |{$JMX.CPU.LOAD.TIME}|The time during which the CPU utilization may exceed the threshold.
|`5m`| |{$JMX.MEM.POOL.NAME.MATCHES}|This macro used in memory pool discovery as a filter.
|`Old Gen\|G1\|Perm Gen\|Code Cache\|Tenured Gen`| |{$JMX.USER}|JMX username.
|| |{$JMX.PASSWORD}|JMX password.
|| ### Items |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |ClassLoading: Loaded class count|Displays number of classes that are currently loaded in the Java virtual machine.
|JMX agent|jmx["java.lang:type=ClassLoading","LoadedClassCount"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Displays the total number of classes that have been loaded since the Java virtual machine has started execution.
|JMX agent|jmx["java.lang:type=ClassLoading","TotalLoadedClassCount"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Displays the total number of classes that have been loaded since the Java virtual machine has started execution.
|JMX agent|jmx["java.lang:type=ClassLoading","UnloadedClassCount"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Displays the total number of classes unloaded since the Java virtual machine has started execution.
|JMX agent|jmx["java.lang:type=Compilation","Name"]**Preprocessing**
Discard unchanged with heartbeat: `30m`
Displays the approximate accumulated elapsed time spent in compilation, in seconds.
|JMX agent|jmx["java.lang:type=Compilation","TotalCompilationTime"]**Preprocessing**
Custom multiplier: `0.001`
Discard unchanged with heartbeat: `10m`
Current heap memory allocated. This amount of memory is guaranteed for the Java virtual machine to use.
|JMX agent|jmx["java.lang:type=Memory","HeapMemoryUsage.committed"]| |Memory: Heap memory maximum size|Maximum amount of heap that can be used for memory management. This amount of memory is not guaranteed to be available if it is greater than the amount of committed memory. The Java virtual machine may fail to allocate memory even if the amount of used memory does not exceed this maximum size.
|JMX agent|jmx["java.lang:type=Memory","HeapMemoryUsage.max"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Current memory usage outside the heap.
|JMX agent|jmx["java.lang:type=Memory","HeapMemoryUsage.used"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Current memory allocated outside the heap. This amount of memory is guaranteed for the Java virtual machine to use.
|JMX agent|jmx["java.lang:type=Memory","NonHeapMemoryUsage.committed"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Maximum amount of non-heap memory that can be used for memory management. This amount of memory is not guaranteed to be available if it is greater than the amount of committed memory. The Java virtual machine may fail to allocate memory even if the amount of used memory does not exceed this maximum size.
|JMX agent|jmx["java.lang:type=Memory","NonHeapMemoryUsage.max"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Current memory usage outside the heap
|JMX agent|jmx["java.lang:type=Memory","NonHeapMemoryUsage.used"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
The approximate number of objects for which finalization is pending.
|JMX agent|jmx["java.lang:type=Memory","ObjectPendingFinalizationCount"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
This is the number of file descriptors we can have opened in the same process, as determined by the operating system. You can never have more file descriptors than this number.
|JMX agent|jmx["java.lang:type=OperatingSystem","MaxFileDescriptorCount"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
This is the number of opened file descriptors at the moment, if this reaches the MaxFileDescriptorCount, the application will throw an IOException: Too many open files. This could mean you are opening file descriptors and never closing them.
|JMX agent|jmx["java.lang:type=OperatingSystem","OpenFileDescriptorCount"]| |OperatingSystem: Process CPU Load|ProcessCpuLoad represents the CPU load in this process.
|JMX agent|jmx["java.lang:type=OperatingSystem","ProcessCpuLoad"]**Preprocessing**
Custom multiplier: `100`
**Preprocessing**
Custom multiplier: `0.001`
**Preprocessing**
Discard unchanged with heartbeat: `30m`
**Preprocessing**
Discard unchanged with heartbeat: `30m`
Number of daemon threads running.
|JMX agent|jmx["java.lang:type=Threading","DaemonThreadCount"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Maximum number of threads being executed at the same time since the JVM was started or the peak was reset.
|JMX agent|jmx["java.lang:type=Threading","PeakThreadCount"]| |Threading: Thread count|The number of threads running at the current moment.
|JMX agent|jmx["java.lang:type=Threading","ThreadCount"]| |Threading: Total started thread count|The number of threads started since the JVM was launched.
|JMX agent|jmx["java.lang:type=Threading","TotalStartedThreadCount"]| ### Triggers |Name|Description|Expression|Severity|Dependencies and additional info| |----|-----------|----------|--------|--------------------------------| |Compilation: {HOST.NAME} uses suboptimal JIT compiler||`find(/Generic Java JMX/jmx["java.lang:type=Compilation","Name"],,"like","Client")=1`|Info|**Manual close**: Yes| |Memory: Heap memory usage is high||`min(/Generic Java JMX/jmx["java.lang:type=Memory","HeapMemoryUsage.used"],{$JMX.HEAP.MEM.USAGE.TIME})>(last(/Generic Java JMX/jmx["java.lang:type=Memory","HeapMemoryUsage.max"])*{$JMX.HEAP.MEM.USAGE.MAX}/100) and last(/Generic Java JMX/jmx["java.lang:type=Memory","HeapMemoryUsage.max"])>0`|Warning|| |Memory: Non-Heap memory usage is high||`min(/Generic Java JMX/jmx["java.lang:type=Memory","NonHeapMemoryUsage.used"],{$JMX.NONHEAP.MEM.USAGE.TIME})>(last(/Generic Java JMX/jmx["java.lang:type=Memory","NonHeapMemoryUsage.max"])*{$JMX.NONHEAP.MEM.USAGE.MAX}/100) and last(/Generic Java JMX/jmx["java.lang:type=Memory","NonHeapMemoryUsage.max"])>0`|Warning|| |OperatingSystem: Opened file descriptor count is high||`min(/Generic Java JMX/jmx["java.lang:type=OperatingSystem","OpenFileDescriptorCount"],{$JMX.FILE.DESCRIPTORS.TIME})>(last(/Generic Java JMX/jmx["java.lang:type=OperatingSystem","MaxFileDescriptorCount"])*{$JMX.FILE.DESCRIPTORS.MAX}/100)`|Warning|| |OperatingSystem: Process CPU Load is high||`min(/Generic Java JMX/jmx["java.lang:type=OperatingSystem","ProcessCpuLoad"],{$JMX.CPU.LOAD.TIME})>{$JMX.CPU.LOAD.MAX}`|Average|| |Runtime: JVM is not reachable||`nodata(/Generic Java JMX/jmx["java.lang:type=Runtime","Uptime"],5m)=1`|Average|**Manual close**: Yes| |Runtime: {HOST.NAME} runs suboptimal VM type||`find(/Generic Java JMX/jmx["java.lang:type=Runtime","VmName"],,"like","Server")<>1`|Info|**Manual close**: Yes| ### LLD rule Garbage collector discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Garbage collector discovery|Garbage collectors metrics discovery.
|JMX agent|jmx.discovery["beans","java.lang:name=*,type=GarbageCollector"]| ### Item prototypes for Garbage collector discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |GarbageCollector: {#JMXNAME} number of collections per second|Displays the total number of collections that have occurred per second.
|JMX agent|jmx["java.lang:name={#JMXNAME},type=GarbageCollector","CollectionCount"]**Preprocessing**
Displays the approximate accumulated collection elapsed time, in seconds.
|JMX agent|jmx["java.lang:name={#JMXNAME},type=GarbageCollector","CollectionTime"]**Preprocessing**
Custom multiplier: `0.001`
Discard unchanged with heartbeat: `10m`
Memory pools metrics discovery.
|JMX agent|jmx.discovery["beans","java.lang:name=*,type=MemoryPool"]| ### Item prototypes for Memory pool discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Memory pool: {#JMXNAME} committed|Current memory allocated.
|JMX agent|jmx["java.lang:name={#JMXNAME},type=MemoryPool","Usage.committed"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Maximum amount of memory that can be used for memory management. This amount of memory is not guaranteed to be available if it is greater than the amount of committed memory. The Java virtual machine may fail to allocate memory even if the amount of used memory does not exceed this maximum size.
|JMX agent|jmx["java.lang:name={#JMXNAME},type=MemoryPool","Usage.max"]**Preprocessing**
Discard unchanged with heartbeat: `10m`
Current memory usage.
|JMX agent|jmx["java.lang:name={#JMXNAME},type=MemoryPool","Usage.used"]| ### Trigger prototypes for Memory pool discovery |Name|Description|Expression|Severity|Dependencies and additional info| |----|-----------|----------|--------|--------------------------------| |Memory pool: {#JMXNAME} memory usage is high||`min(/Generic Java JMX/jmx["java.lang:name={#JMXNAME},type=MemoryPool","Usage.used"],{$JMX.MP.USAGE.TIME:"{#JMXNAME}"})>(last(/Generic Java JMX/jmx["java.lang:name={#JMXNAME},type=MemoryPool","Usage.max"])*{$JMX.MP.USAGE.MAX:"{#JMXNAME}"}/100) and last(/Generic Java JMX/jmx["java.lang:name={#JMXNAME},type=MemoryPool","Usage.max"])>0`|Warning|| ## Feedback Please report any issues with the template at [`https://support.zabbix.com`](https://support.zabbix.com) You can also provide feedback, discuss the template, or ask for help at [`ZABBIX forums`](https://www.zabbix.com/forum/zabbix-suggestions-and-feedback)