Fortinet black logo

User Guide

JMX (Linux)

24.1.0
Copy Link
Copy Doc ID af1daa65-c273-11ec-9fd1-fa163e15d75b:685333
Download PDF

JMX (Linux)

The JMX plugin allows you to connect and remotely monitor metrics from your Java applications.

Please note: We will not go into detail on enabling JMX or configuring it to use password authentication. More information can be found on Oracle’s site. Please make sure that your server is using Oracle’s JDK and Python’s JPype or OpenJDK with the proper workaround for JPype.

Agent Configuration

Once the agent is installed, you will need to add the following information to the agent config file (//etc/fm-agent/fm_agent.cfg). If you have multiple Java processes running on different JMX ports, use comma-separated values as shown below:

[jmx]
username = username1, username2
password = password1, password2
port = port1, port2
host = hostname1, hostname2
jvm_path = /PATH/TO/JVM

Fill in the username and password fields with the ones you have set for your application, in our case, our Tomcat admin username and password was used. You can also configure this without the username/password fields if you have your java application configured without the need for authentication. Specify the port/s and host/s from the setenv.sh you created and then replace the last field with the correct path to your Java install. If you need the path for the Java install, it can be found by grabbing the output of the command below:

locate libjvm.so

If you have multiple locations returned, make sure to use the one for your current Java version. In our case it was:

/usr/java/jdk1.8.0_25/jre/lib/amd64/server/libjvm.so

Control Panel Configuration

To use the JMX plugin, first select Java from the monitoring catalog.

Then you can add JVM metrics to monitor from the agent using the example below.

Metric Syntax

The syntax for this metric is a forward-slash separated URI. You can obtain the MBean object from your JMX browser and the attribute by drilling down in the browser to get the attribute name.

Copy Codejava.lang:type=Threading/ThreadCount
java.lang:type=Memory/HeapMemoryUsage/used
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=check_result_stream/Count

If you would like to inspect the JMX plugin in more detail you can find the python script for it in the /usr/lib/fm-agent/plugins folder.

If you have followed the steps above and the new metric and plugin do not show properly, you may need to manually rebuild the agent’s metadata. You can do this by following the guide here.

JMX (Linux)

The JMX plugin allows you to connect and remotely monitor metrics from your Java applications.

Please note: We will not go into detail on enabling JMX or configuring it to use password authentication. More information can be found on Oracle’s site. Please make sure that your server is using Oracle’s JDK and Python’s JPype or OpenJDK with the proper workaround for JPype.

Agent Configuration

Once the agent is installed, you will need to add the following information to the agent config file (//etc/fm-agent/fm_agent.cfg). If you have multiple Java processes running on different JMX ports, use comma-separated values as shown below:

[jmx]
username = username1, username2
password = password1, password2
port = port1, port2
host = hostname1, hostname2
jvm_path = /PATH/TO/JVM

Fill in the username and password fields with the ones you have set for your application, in our case, our Tomcat admin username and password was used. You can also configure this without the username/password fields if you have your java application configured without the need for authentication. Specify the port/s and host/s from the setenv.sh you created and then replace the last field with the correct path to your Java install. If you need the path for the Java install, it can be found by grabbing the output of the command below:

locate libjvm.so

If you have multiple locations returned, make sure to use the one for your current Java version. In our case it was:

/usr/java/jdk1.8.0_25/jre/lib/amd64/server/libjvm.so

Control Panel Configuration

To use the JMX plugin, first select Java from the monitoring catalog.

Then you can add JVM metrics to monitor from the agent using the example below.

Metric Syntax

The syntax for this metric is a forward-slash separated URI. You can obtain the MBean object from your JMX browser and the attribute by drilling down in the browser to get the attribute name.

Copy Codejava.lang:type=Threading/ThreadCount
java.lang:type=Memory/HeapMemoryUsage/used
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=check_result_stream/Count

If you would like to inspect the JMX plugin in more detail you can find the python script for it in the /usr/lib/fm-agent/plugins folder.

If you have followed the steps above and the new metric and plugin do not show properly, you may need to manually rebuild the agent’s metadata. You can do this by following the guide here.