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.
Prerequisite
- Ensure the configured TOMCAT_USERNAME is rightly assigned to the manager-script role in the tomcat-users.xml file. The username and password provided should be given in the Tomcat script. Sample code:
role rolename="manager-gui"
role rolename="manager-script"
role rolename="manager-jmx"
role rolename="manager-status"
role rolename="admin-script"
role rolename="admin-gui"
user username="admin" password="admin" roles="admin-gui,manager-script,manager-jmx,manager-status,admin-script,manager-gui”
Plugin Installation
- Download and install the latest version of the Site24x7 Linux agent in the server where you plan to run the plugin. If it is installed successfully, you will see a Linux server monitor in the Site24x7 Control Panel. This confirms that the agent is able to communicate with our data center.
- Download the tomcat_connector.py, tomcat_overallmemory.py or the tomcat_memorypool.py from our GitHub repository.
- The default python path given in the plugin script is #!/usr/bin/python. If you wish to provide an alternate python path, replace the existing one preceded by the shebang character "#!".
- Change the values of TOMCAT_PORT, TOMCAT_USERNAME, TOMCAT_PASSWORD, TOMCAT_URL, TOMCAT_CONNECTOR, and TOMCAT_TIMEOUT to match your configuration
- Create a directory with the name 'tomcat_connector' or 'tomcat_overallmemory' or 'tomcat_memorypool', under Site24x7 Linux agent plugin directory '/opt/site24x7/monagent/plugins/' and place the plugin files in their respective folders.
View Data in the Site24x7 Web Client
- Log in to Site24x7 and go to Server > Plugins > Name of Plugin Monitor.
- You will be able to view the performance charts on the various metrics for your Tomcat server.
Customize your Plugin
To add/delete an attribute, or change its unit, edit the Python script file and make the desired changes. Increment the plugin version and from the next consecutive data collection, the changes would be reflected.
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