Efficient monitoring of your Apache Tomcat servers is essential as poor performance can have a direct influence on the end-user experience. With Site24x7 Tomcat plugin, get a detailed view of all the critical Tomcat service metrics in a single, intuitive dashboard.
This document details how to configure the Apache Tomcat plugin and the monitoring metrics for providing in-depth visibility into the performance, availability, and usage stats of Tomcat servers.
Monitoring Metrics
The performance metrics for Tomcat falls under three categories: thread pool metrics, overall memory metrics, and usage metrics for each memory pool.
Total number of threads
thread_count
is critical for tracking the resource consumption. This helps to prevent bottlenecks and detect thread pool exhaustion.
Busy threads count and total number of threads allowed
Comparing the metrics thread_busy
and thread_count
with thread_allowed
gives an idea on the resource consumption.
Bytes received and bytes sent
Relate the thread count metrics with the bytes_received
and bytes_sent
to know the capacity of your web server.
Total number of errors
error_count
gives the number of errors per second on all request processors.
Number of requests
The request_count
metric gives the number of requests per second across all request processors.
Free Memory
The free_memory
shows the amount of heap space currently available to the Java Virtual Machine (JVM).
Maximum Memory
The max_memory
is the maximum size of the heap space not including the permanent generation area.
Time taken for processing the request
The sum of request processing times across all requests handled by the request processors is shown under processing_time
.
Total Memory
The total_memory
is the memory currently allocated to the JVM heap space.
Usage stats of each memory pool
Data from the metric usage_"name of the memory pool"
gives the user a quick look on the memory usage. This can help manage memory resources proactively and resolve downtimes in production.
Prerequisites
- Download and install the Site24x7 server monitoring agent (Linux | Windows) in the server where you plan to run the plugin.
-
For Linux servers, follow the steps below:
- Navigate to the following directory:
/opt/tomcat/conf
- Open the tomcat-users.xml file.
- Ensure the following roles are added to the user:
<user username="user" password="user" roles="manager-gui,admin-gui"/><user username="user" password="user" roles="manager-script"/>
- Restart the Tomcat server.
- Navigate to the following directory:
-
For Windows servers, follow the steps below:
- Navigate to the following directory:
<tomcat_dowloaded_directory>\conf
- Open the tomcat-users.xml file.
- Ensure the following roles are added to the user:
<user username="user" password="user" roles="manager-gui,admin-gui"/><user username="user" password="user" roles="manager-script"/>
- Restart the Tomcat server.
- Navigate to the following directory:
Plugin Installation
- Create a folder named tomcat.
- Download the tomcat.py and the tomcat.cfg files from our GitHub repository and the place them in the tomcat folder.
wget https://raw.githubusercontent.com/site24x7/plugins/master/tomcat/tomcat.py && sed -i "1s|^.*|#! $(which python3)|" tomcat.pywget https://raw.githubusercontent.com/site24x7/plugins/master/tomcat/tomcat.cfg
- To check if the plugin is working, execute the command below and check for a valid JSON output with applicable metrics and their corresponding values.
python tomcat.py --host "hostname" --port "port" --username "username" --password "password"
- Add the applicable configurations in the tomcat_connector.cfg file:
[tomcat]host = "localhost"port = "8080"username = "admin"password = "admin"plugin_version = "1"logs_enabled = "true"log_type_name = "Tomcat Access Logs"log_file_path = "/opt/*tomcat*/logs/*access*.txt"
- Follow the steps in this article to learn how to run the Python script on a Windows server. You don't need to do this for Linux.
- Move the tomcat folder to the Site24x7 server monitoring plugin directory.
For Linux: /opt/site24x7/monagent/plugins/
For Windows: C:\Program Files (x86)\Site24x7\WinAgent\monitoring\plugins\
- Log in to Site24x7.
- Navigate to Plugins and click the required monitor.
Plugin Contribution
Feel free to contribute to our existing plugin and come up with suggestions or feedback on our Community.
Related Articles
- ActiveMQ Monitoring
- Memcached Monitoring
- Nagios Integration
- 100+ Plugin Integrations
- Create custom plugins - Linux and Windows