Fortinet black logo

User Guide

JMX (Windows)

24.2.0
Copy Link
Copy Doc ID af1daa65-c273-11ec-9fd1-fa163e15d75b:396597
Download PDF

JMX (Windows)

JMX comes as a base plugin with the Windows Agent. Make sure the server has the agent installed and JMX is enabled for your Java installation and the JRE location is set in your path variable. This is more in-depth than this tutorial will cover, but the best way to know if you need to set this is to open a new CMD prompt and type:
echo %JAVA_HOME%

Agent Configuration

You will then need to edit your agent config file located at C:\Program Files\FortiMonitorAgent\Agent.config. Close to the bottom of the file, you will see tags that start with <config> make sure to put your code in this block and substitute your information for the placeholders below:

<jmx>
<add key="username" value="admin" />
<add key="password" value="password" />
<add key="host" value="localhost" />
<add key="port" value="8686" />
<add key="serverPort" value="8989"/>
<add key="socketTimeout" value="3500"/>
<add key="useSSL" value="true"/>
<add key="trustStore" value="c:\jmx-test\keystore.jks" />
<add key="trustStorePassword" value="keystore-password" />
</jmx>

Where:

  • username / password - the credentials used for JMX.

  • host/port - the host and port configured for JMX.

  • serverPort - the port set for the JMX agent to accept connections. The default is 8989.

  • socketTimeout - the socket timeout from the Windows agent to the JMX agent. The default is 2500ms.

If the JMX server is running with SSL enabled, the following options need to be specified:

  1. useSSL - set to true.

  2. trustStore - the file path to the trustStore used for key/certificate management.

  3. trustStorePassword - the password for the trustStore specified above.

Look for the <plugin> tag then add the following:
<resource categoryTextKey= "jmx" category="JMX" textKey="jmx.custom" label="Custom JMX Metric" />

Ideally, the above line should be added after the event_log line. For example:
<plugin>

<resource categoryTextKey="event_log" category="Event Logs" textKey="count" unit="count" label="Event logs count" />

<resource categoryTextKey="jmx" category="JMX" textKey="jmx.custom" label="Custom JMX Metric" />

</plugin>


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.


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

The entries shown above are the combination of the BEAN and the attributes which you would like to query on. You can run these in a command-line interface as shown here.

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 (Windows)

JMX comes as a base plugin with the Windows Agent. Make sure the server has the agent installed and JMX is enabled for your Java installation and the JRE location is set in your path variable. This is more in-depth than this tutorial will cover, but the best way to know if you need to set this is to open a new CMD prompt and type:
echo %JAVA_HOME%

Agent Configuration

You will then need to edit your agent config file located at C:\Program Files\FortiMonitorAgent\Agent.config. Close to the bottom of the file, you will see tags that start with <config> make sure to put your code in this block and substitute your information for the placeholders below:

<jmx>
<add key="username" value="admin" />
<add key="password" value="password" />
<add key="host" value="localhost" />
<add key="port" value="8686" />
<add key="serverPort" value="8989"/>
<add key="socketTimeout" value="3500"/>
<add key="useSSL" value="true"/>
<add key="trustStore" value="c:\jmx-test\keystore.jks" />
<add key="trustStorePassword" value="keystore-password" />
</jmx>

Where:

  • username / password - the credentials used for JMX.

  • host/port - the host and port configured for JMX.

  • serverPort - the port set for the JMX agent to accept connections. The default is 8989.

  • socketTimeout - the socket timeout from the Windows agent to the JMX agent. The default is 2500ms.

If the JMX server is running with SSL enabled, the following options need to be specified:

  1. useSSL - set to true.

  2. trustStore - the file path to the trustStore used for key/certificate management.

  3. trustStorePassword - the password for the trustStore specified above.

Look for the <plugin> tag then add the following:
<resource categoryTextKey= "jmx" category="JMX" textKey="jmx.custom" label="Custom JMX Metric" />

Ideally, the above line should be added after the event_log line. For example:
<plugin>

<resource categoryTextKey="event_log" category="Event Logs" textKey="count" unit="count" label="Event logs count" />

<resource categoryTextKey="jmx" category="JMX" textKey="jmx.custom" label="Custom JMX Metric" />

</plugin>


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.


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

The entries shown above are the combination of the BEAN and the attributes which you would like to query on. You can run these in a command-line interface as shown here.

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.