Even though Java offers JMX over RMI for runtime information like thread and memory consumption, you can also activate SNMP to read at least a subset.
In my opinion usage of a standard monitoring tool has several advantages over JMX-based visualization in JConsole or Lambda Probe:
- Statistics fit into centralized reporting, e.g. for SLAs.
- The tools are independent of the Java VM. If the VM freezes, the history is still available.
First you need to enable the SNMP Agent in your Java VM. Please find the details here and an outline in the following list:
- Prepare an ACL configuration at
$JAVA_HOME/lib/management/snmp.acl. On Sun’s Java 6 for Ubuntu 10.04 64 Bit you will find these files in the package
- Use the following options on the command line while starting a JVM to enable SNMP:
If you really put the
$JAVA_HOME/lib/management, it’s very likely, you will not need to specify the
Now you are ready to read the internal state over SNMP: