Fortinet Document Library

Version:


Table of Contents

User Guide

21.4.0
Copy Link

Tomcat (JMX)

The Tomcat plugin lets you monitor a number of metrics on your web server. If you cannot find this plugin in the /usr/lib/panopta-agent/plugins folder, update your Agent.

Enable JMX on Tomcat

Before configuring the Agent, make sure that JMX is enabled on the host where your Tomcat web server is deployed.

1. Create setenv.sh file in the Tomcat bin directory. For example, if your bin directory is /opt/tomcat/apache-tomcat-9.0.37/bin/, run the following command:
export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8008 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=/opt/tomcat/apache-tomcat-9.0.37/conf/jmxremote.access -Dcom.sun.management.jmxremote.password.file=/opt/tomcat/apache-tomcat-9.0.37/conf/jmxremote.password"

The command also allows you to set the port that you want to use for JMX and the path where the jmx.access and jmx.password files must be created.

Be sure that the Tomcat user owns the new setenv.sh file.

2. Create the jmx.access and jmx.password files.
jmx.access
<USERNAME> readonly

jmx.password
<USERNAME> <PASSWORD>

You can set the username and password as desired. These will be set in the FortiMonitor configuration file in the following section.

Also, make sure that the tomcat user owns these files and that the password file has permission 600.

-rw-r--r--. 1 tomcat tomcat 18 Jul 31 12:52 jmxremote.access
-rw-------. 1 tomcat tomcat 16 Jul 31 12:52 jmxremote.password

3. Restart the Tomcat service.

a. Navigate to tomcat_home/bin.

b. Run the following command to stop Apache Tomcat:

./shutdown.sh

c. Run the following command to restart Apache Tomcat:

./startup.sh

Agent configuration

Once the agent is installed, you will need to edit the Agent config file (/etc/panopta-agent/panopta_agent.cfg) and set the following parameters:

  • username and password – The username and password that you used in the jmx.password file.

  • port – The port where Tomcat is listening to. You can enter any number of ports in the port parameter for each Tomcat instance that you have installed in the server. Each port entered should be separated by a comma.

  • host – The host where your Tomcat instances are deployed. If you have multiple Tomcat instances, make sure that you enter the hostname, separated by a comma, for each Tomcat instance you want to monitor. See the following example for more details.

  • jvm_path – The path to your Java installation. Run locate libjvm.so to determine your JVM path.

The following Agent configuration file shows the configuration for multiple Tomcats running on a single server.

Control Panel configuration

If you have not already, read the Add FortiMonitor Agent checks article to learn how to set up monitoring for any agent plugin. To use the Tomcat plugin, first select Tomcat (JMX) from the monitoring catalog.

There are a number of metrics available to monitor.

Metric

Unit                                                       

Action/Classloadingtime

Action/Errorcount

Action/Loadtime

Action/Maxtime

Action/Processingtime

Action/Requestcount

Average total memory

seconds

Count of errors

errors

Count of expired sessions

sessions

Count of requests

requests

Current count of busy threads

threads

Current count of threads

threads

Default/Classloadingtime

Default/Errorcount

Default/Loadtime

Default/Maxtime

Default/Processingtime

Default/Requestcount

DynamicJAXWSServlet/Classloadingtime

DynamicJAXWSServlet/Errorcount

DynamicJAXWSServlet/Loadtime

DynamicJAXWSServlet/Maxtime

DynamicJAXWSServlet/Processingtime

DynamicJAXWSServlet/Requestcount

GC/Classloadingtime

GC/Errorcount

GC/Loadtime

GC/Maxtime

GC/Processingtime

GC/Requestcount

HTMLManager/Classloadingtime

HTMLManager/Errorcount

HTMLManager/Loadtime

HTMLManager/Maxtime

HTMLManager/Processingtime

HTMLManager/Requestcount

J4p-agent/Classloadingtime

J4p-agent/Errorcount

J4p-agent/Loadtime

J4p-agent/Maxtime

J4p-agent/Processingtime

J4p-agent/Requestcount

JMXProxy/Classloadingtime

JMXProxy/Errorcount

JMXProxy/Loadtime

MXProxy/Maxtime

JMXProxy/Processingtime

JMXProxy/Requestcount

Jsp/Classloadingtime

Jsp/Errorcount

Jsp/Loadtime

Jsp/Maxtime

Jsp/Processingtime

Jsp/Requestcount

JVM maximum memory

megabytes

JVM total memory

megabytes

Longest sessions alive time

seconds

Manager/Classloadingtime

Manager/Errorcount

Manager/Loadtime

Manager/Maxtime

Manager/Processingtime

Manager/Requestcount

Maximum number of active sessions

sessions

Maximum number of threads

threads

Maximum processing time

milliseconds

Mem/Classloadingtime

Mem/Errorcount

Mem/Loadtime

Mem/Maxtime

Mem/Processingtime

Mem/Requestcount

Memory used

MB

Number of loaded JSPs

JSPs

Number of reloaded JSPs

JSPs

Params/Classloadingtime

Params/Errorcount

Params/Loadtime

Params/Maxtime

Params/Processingtime

Params/Requestcount

Rejected sessions creations

sessions

RSDispatcher/Classloadingtime

RSDispatcher/Errorcount

RSDispatcher/Loadtime

RSDispatcher/Maxtime

RSDispatcher/Processingtime

RSDispatcher/Requestcount

ShutdownRestart/Classloadingtime

ShutdownRestart/Errorcount

ShutdownRestart/Loadtime

ShutdownRestart/Maxtime

ShutdownRestart/Processingtime

ShutdownRestart/Requestcount

Status/Classloadingtime

Status/Errorcount

Status/Loadtime

Status/Maxtime

Status/Processingtime

Status/Requestcount

Time to start up

milliseconds

Total active sessions

sessions

Total bytes received

bytes

Total bytes sent

bytes

Total number of active sessions since startup

Total number of rejected sessions since startup

Total number of requests served since startup

Total processing time

seconds

Total processing time (in milliseconds) since startup                           

Total sessions count

sessions

Total/Averagesessionalivetime

Total/Bytesreceived

Total/Bytessent

Total/Currentthreadbusy

Total/Currentthreadcount

Total/Errorcount

Total/Expiredsessions

Total/Freememory

Total/JSPsloaded

Total/JSPsreloaded

Total/Longestsessionalivetime

Total/Maxactivesessions

Total/Maxmemory

Total/Maxprocessingtime

Total/Maxthreads

Total/Requestcount

Total/Totalmemory

WSServlet/Classloadingtime

WSServlet/Errorcount

WSServlet/Loadtime

WSServlet/Maxtime

WSServlet/Processingtime

WSServlet/Requestcount 

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

Tomcat (JMX)

The Tomcat plugin lets you monitor a number of metrics on your web server. If you cannot find this plugin in the /usr/lib/panopta-agent/plugins folder, update your Agent.

Enable JMX on Tomcat

Before configuring the Agent, make sure that JMX is enabled on the host where your Tomcat web server is deployed.

1. Create setenv.sh file in the Tomcat bin directory. For example, if your bin directory is /opt/tomcat/apache-tomcat-9.0.37/bin/, run the following command:
export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8008 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=/opt/tomcat/apache-tomcat-9.0.37/conf/jmxremote.access -Dcom.sun.management.jmxremote.password.file=/opt/tomcat/apache-tomcat-9.0.37/conf/jmxremote.password"

The command also allows you to set the port that you want to use for JMX and the path where the jmx.access and jmx.password files must be created.

Be sure that the Tomcat user owns the new setenv.sh file.

2. Create the jmx.access and jmx.password files.
jmx.access
<USERNAME> readonly

jmx.password
<USERNAME> <PASSWORD>

You can set the username and password as desired. These will be set in the FortiMonitor configuration file in the following section.

Also, make sure that the tomcat user owns these files and that the password file has permission 600.

-rw-r--r--. 1 tomcat tomcat 18 Jul 31 12:52 jmxremote.access
-rw-------. 1 tomcat tomcat 16 Jul 31 12:52 jmxremote.password

3. Restart the Tomcat service.

a. Navigate to tomcat_home/bin.

b. Run the following command to stop Apache Tomcat:

./shutdown.sh

c. Run the following command to restart Apache Tomcat:

./startup.sh

Agent configuration

Once the agent is installed, you will need to edit the Agent config file (/etc/panopta-agent/panopta_agent.cfg) and set the following parameters:

  • username and password – The username and password that you used in the jmx.password file.

  • port – The port where Tomcat is listening to. You can enter any number of ports in the port parameter for each Tomcat instance that you have installed in the server. Each port entered should be separated by a comma.

  • host – The host where your Tomcat instances are deployed. If you have multiple Tomcat instances, make sure that you enter the hostname, separated by a comma, for each Tomcat instance you want to monitor. See the following example for more details.

  • jvm_path – The path to your Java installation. Run locate libjvm.so to determine your JVM path.

The following Agent configuration file shows the configuration for multiple Tomcats running on a single server.

Control Panel configuration

If you have not already, read the Add FortiMonitor Agent checks article to learn how to set up monitoring for any agent plugin. To use the Tomcat plugin, first select Tomcat (JMX) from the monitoring catalog.

There are a number of metrics available to monitor.

Metric

Unit                                                       

Action/Classloadingtime

Action/Errorcount

Action/Loadtime

Action/Maxtime

Action/Processingtime

Action/Requestcount

Average total memory

seconds

Count of errors

errors

Count of expired sessions

sessions

Count of requests

requests

Current count of busy threads

threads

Current count of threads

threads

Default/Classloadingtime

Default/Errorcount

Default/Loadtime

Default/Maxtime

Default/Processingtime

Default/Requestcount

DynamicJAXWSServlet/Classloadingtime

DynamicJAXWSServlet/Errorcount

DynamicJAXWSServlet/Loadtime

DynamicJAXWSServlet/Maxtime

DynamicJAXWSServlet/Processingtime

DynamicJAXWSServlet/Requestcount

GC/Classloadingtime

GC/Errorcount

GC/Loadtime

GC/Maxtime

GC/Processingtime

GC/Requestcount

HTMLManager/Classloadingtime

HTMLManager/Errorcount

HTMLManager/Loadtime

HTMLManager/Maxtime

HTMLManager/Processingtime

HTMLManager/Requestcount

J4p-agent/Classloadingtime

J4p-agent/Errorcount

J4p-agent/Loadtime

J4p-agent/Maxtime

J4p-agent/Processingtime

J4p-agent/Requestcount

JMXProxy/Classloadingtime

JMXProxy/Errorcount

JMXProxy/Loadtime

MXProxy/Maxtime

JMXProxy/Processingtime

JMXProxy/Requestcount

Jsp/Classloadingtime

Jsp/Errorcount

Jsp/Loadtime

Jsp/Maxtime

Jsp/Processingtime

Jsp/Requestcount

JVM maximum memory

megabytes

JVM total memory

megabytes

Longest sessions alive time

seconds

Manager/Classloadingtime

Manager/Errorcount

Manager/Loadtime

Manager/Maxtime

Manager/Processingtime

Manager/Requestcount

Maximum number of active sessions

sessions

Maximum number of threads

threads

Maximum processing time

milliseconds

Mem/Classloadingtime

Mem/Errorcount

Mem/Loadtime

Mem/Maxtime

Mem/Processingtime

Mem/Requestcount

Memory used

MB

Number of loaded JSPs

JSPs

Number of reloaded JSPs

JSPs

Params/Classloadingtime

Params/Errorcount

Params/Loadtime

Params/Maxtime

Params/Processingtime

Params/Requestcount

Rejected sessions creations

sessions

RSDispatcher/Classloadingtime

RSDispatcher/Errorcount

RSDispatcher/Loadtime

RSDispatcher/Maxtime

RSDispatcher/Processingtime

RSDispatcher/Requestcount

ShutdownRestart/Classloadingtime

ShutdownRestart/Errorcount

ShutdownRestart/Loadtime

ShutdownRestart/Maxtime

ShutdownRestart/Processingtime

ShutdownRestart/Requestcount

Status/Classloadingtime

Status/Errorcount

Status/Loadtime

Status/Maxtime

Status/Processingtime

Status/Requestcount

Time to start up

milliseconds

Total active sessions

sessions

Total bytes received

bytes

Total bytes sent

bytes

Total number of active sessions since startup

Total number of rejected sessions since startup

Total number of requests served since startup

Total processing time

seconds

Total processing time (in milliseconds) since startup                           

Total sessions count

sessions

Total/Averagesessionalivetime

Total/Bytesreceived

Total/Bytessent

Total/Currentthreadbusy

Total/Currentthreadcount

Total/Errorcount

Total/Expiredsessions

Total/Freememory

Total/JSPsloaded

Total/JSPsreloaded

Total/Longestsessionalivetime

Total/Maxactivesessions

Total/Maxmemory

Total/Maxprocessingtime

Total/Maxthreads

Total/Requestcount

Total/Totalmemory

WSServlet/Classloadingtime

WSServlet/Errorcount

WSServlet/Loadtime

WSServlet/Maxtime

WSServlet/Processingtime

WSServlet/Requestcount 

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