I would like to monitor my Java Virtual Machines. How can I integrate my Java infrastructure into PRTG in order to gather corresponding monitoring data? Is it possible to use JMX with PRTG for this purpose?
This article applies to PRTG Network Monitor 13 or later
JVM (Java Virtual Machine) Monitoring
So far, PRTG does not support native JMX (Java Management Extension) monitoring. However, you can keep an eye on your Java infrastructure via SNMP. For this purpose, enable the JVM SNMP Agent of your Java VM to gather basic information about the JVM; this approach will provide you data about the virtual machine itself.
Alternatively, if you want to dig deeper into data of applications which run on the JVM, you can integrate your own SNMP interface into the JVM; this is a very flexible solution and makes it possible to gather monitoring data of single applications on the JVM but requires a lot of implementation effort.
It depends on your requirements which approach you choose. If it is sufficient for you to work with the basic parameters as supplied by the JVM, you can use its SNMP agent; if you need specific values from your own MBeans, consider to integrate a dedicated SNMP interface.
Monitoring the JVM via Its Native SNMP Interface
As of Java 6, you can use the JVM SNMP Agent which publishes the standard MIB for the JVM instrumentation. In order to monitor your Java VM with SNMP, you have to enable the SNMP agent first. For details, please see the Oracle Java SE Documentation:
The JVM SNMP Agent is a small built-in SNMPv2c agent that uses the JVM-MANAGEMENT-MIB. Using this agent, you can monitor the following JVM related parameters, for example:
- class loading
- memory management
- resources of the operating system the JVM is running on
Follow these steps in order to use this MIB in PRTG:
- Get the MIB file here.
- Import the MIB file and convert it to an OID library for PRTG.
- Create a corresponding SNMP Library sensor.
Integrating Your Own SNMP Interface into the JVM
Unfortunately, the built-in JVM SNMP agent is not extensible. You cannot use it to expose your own MIB. The agent also provides only basic SNMP v2c security. If you want to use SNMPv3 for security reasons, it would be neither sufficient. The SNMP agent is exposed only as a black-box agent—see Oracle’s blog article What is the JVM SNMP Agent? for details.
If you want to expose the MIB, use SNMPv3, or need specific values from your MBeans, you will have to use a Java SNMP toolkit. For example, you can use SNMP4J – The Object Oriented SNMP API for Java Managers and Agents, “an enterprise class free open source and state-of-the-art SNMP implementation for Java 2SE 1.4 or later.” However, this approach will require deeper knowledge of SNMP.
Please see also the following blog article by Oracle for a decision which way you choose and how to set up JVM monitoring via SNMP: JVM Monitoring: JMX or SNMP?