This article applies to PRTG Network Monitor 14.x.10 or later
How can I monitor Java applications using Java Management Extensions (JMX) with a PRTG Mini Probe, and is there an example of gathering data directly from JMX?
Important notice: The information in this article is outdated. Mini probes are deprecated as the OpenSSL version required to run them is out of support. You can no longer install new mini probes.
JMX Monitoring with the PRTG Mini Probe
Usually, PRTG monitors systems agentless so you do not have to install any software on target devices. PRTG probes connect directly to the remote system via SSH, WMI, SNMP, etc. to take the desired measurements. Agentless monitoring brings a lot of advantages for you because it is easy to set up and you do not have to maintain anything, but some situations require other methods than agentless.
For example, Java Management Extension (JMX) monitoring is one of those because of its potential complexity. We provide instructions for monitoring a Java Virtual Machine (JVM) via SNMP in this article. However, this shows that installing a small piece of software on the target system might be a better idea in order to monitor data more easily. For this purpose, PRTG offers two options: You can create an HTTP Push Data sensor or you use the PRTG Mini Probe interface.
PRTG Mini Probes work similar like the “big” local and remote probes but with a smaller set of sensor types. You are completely free in implementing and adjusting mini probes depending on which monitoring data you need. The Mini Probe API is publicly available so you can create your own individual probes. Or you simply extend the code of our PRTG JMX Mini Probe proof-of-concept and add your own sensor types.
This article describes the Java-based open source code for a PRTG Mini Probe that you can run on any Java VM to monitor it via JMX.
Note: This article is provided for your information only. The steps described here have been tested carefully. However, we cannot offer deep technical support for customizing this proof of concept nor for writing your own mini probes.
Note: We do not further develop the currently available Mini Probe API because we plan major changes to the underlying API in PRTG. You can still use the JMX Mini Probe, for example, if the available HTTP push sensors are not sufficient for your needs.
JMX Mini Probe (Open Source)
You are free to use the Mini Probe API in order to implement probes and the corresponding sensors for any application scenario. So the Mini Probe helps you gather monitoring data from systems which do not run the supported Windows versions. You can find the full documentation of the Mini Probe API here.
Because there is demand from time to time by our customers for JMX monitoring and the proposed method via SNMP is not completely sufficient, we provide you a Mini Probe proof-of-concept for this purpose. The JMX Mini Probe implementation is intended to demonstrate the capabilities of the Mini Probe interface and to give you a starting point for creating your own probe for JMX.
This Mini Probe proof-of-concept is written in Java. It can run the monitoring processes in standalone mode or in an application container and delivers the results back to the PRTG core server via the PRTG Mini Probe interface.
Get the JMX Mini Probe on GitHub!
Requirements
You need to fulfill only a few prerequisites to monitor with the JMX Mini Probe:
- PRTG Core Server: version 14.x.10 or later
- Running the probe in standalone mode: Java SE 1.6 or higher
- Running the probe in an application container: Java EE 6 compliant or higher
Installation
Please follow the steps below to get the JMX Mini Probe up and running:
1) Prepare your PRTG server:
- Set your PRTG server to use HTTPS: In the PRTG web interface, navigate to Setup | System Administration | User Interface, section Web Server, and choose Secure HTTPS server in section TCP Port for Web Server.
Note: Other connection methods are not allowed! - In the PRTG web interface, navigate to Setup | System Administration | Core & Probes and define the settings as given in the next steps.
- Define an Access Key for the JMX Mini Probe. You can also use an existing one.
- Add an appropriate IP filter in section Allow IPs. Use, for example, any.
- Allow Mini Probe connections: Go to section Probe Connection Settings and allow Mini Probes to connect. You can specify a custom Mini Probe port as of PRTG version 14.x.13.
- Now check that you can reach your PRTG server from the machine on which the JMX Mini Probe will run: e.g., execute the command
wget https://<your_PRTG_server>
Note: If you get an SSL handshake failure, it might be necessary to choose the weakened SSL security option for the web server in the PRTG System Administration! (see Setup | System Administration | User Interface)
2) Prepare and start the JMX Mini Probe
Download the JMX Mini Probe package from GitHub. Then you have two options to run the JMX probe: Either you start it as standalone in its own virtual machine, or you add it to an application container.
Note:
- Before you start, please ensure that your PRTG core server is up and running. Currently, the JMX probe is not able to re-send the initial announce request.
- Please also make sure that you have working remote access over JMX to the devices you want to monitor, regardless of whether you use the JMX Mini Probe in standalone mode (option 1) or in an application container (option 2). You might find helpful tips in this stackoverflow article on Connecting remote tomcat JMX instance using jConsole.
Option 1: JMX Mini Probe in standalone mode
In standalone mode, the probe will run in its own threadpool so you do not need to have an application server installed.
- Add the JMX probe package to its dedicated JVM.
- Create a config file prtgjmx.properties.
- Ensure write access to prtgjmx.properties for the UID (user, service) which runs the probe.
- Add the following parameters to prtgjmx.properties:
key=prtg_access_key
host=your_prtg_server
- Replace prtg_access_key with the access key you have defined in PRTG before (see above).
- Replace your_prtg_server with the IP address or DNS name of your PRTG server.
- Start the probe with the following command:
java -jar JMXProbe.war –c prtgjmx.properties
- Approve the new probe connection in the PRTG web interface. The acknowledgement works like for a new remote probe connection.
Option 2: JMX Mini Probe in an application container
If you want to run the JMX probe in an app container, add the JAR files to it and follow the steps below:
- Create a config file prtgjmx.properties.
- Make the config file writable by the UID that runs the application server.
- Add the following parameters to the config file (see description of standalone mode):
key=prtg_access_key
host=your_prtg_server
- Add the following line to the server’s Java options and provide the path to the config file accordingly:
com.paessler.jmxprobe.config=/path_to_config_file
- Approve the new probe connection in the PRTG web interface like for a new remote probe connection.
Default Sensors
After you have got the JMX probe running, you can work with it in the PRTG web interface as usual, e.g., add sensors, review monitoring data, create notifications, etc.
By default, the JMX Mini Probe contains the following sensors to monitor Java applications via JMX:
- JMX VM Health Sensor: Shows various health parameters for the JVM, for example, information about heap memory, about threads, and about loaded classes.
- Custom MBean Attributes Sensor: Monitors MBean attributes which you can define in the sensor settings via their object name. You can use the following unit types for the objects: Disk (bytes), Memory (bytes), Bandwidth (bytes), CPU (%), Count, Percent, File (bytes).
Please see Monitoring and Managing MBeans in the Oracle documentation about how to get MBeans available and how to find out the desired attribute names.
In order to monitor these sensors, you have to provide an RMI Connection String in the particular sensor settings, so specify a JMX service URL. It has to match this syntax:service:jmx:protocol://[host[:port][:path]]
It could look like this, for example:service:jmx:rmi:///jndi/rmi://localhost:9010/jmxrmi
See also The JMX Service URL in the Oracle documentation.
You can adjust these default sensors or add even new ones to the probe package. Please refer to PRTG Manual: Mini Probe API for more information.