Tomcat
Introduction
Tomcat is an open-source web server and Java Servlet container developed by the Apache Software Foundation. It provides a platform for running Java-based web applications, including JavaServer Pages (JSP) and Java Servlets.
Getting Started
Compatibility
The Tomcat O11ySource is compatible with all versions equal to or greater than 8.0.0.
Data Collection Method
vuSmartMaps collects health and performance data for Tomcat server using VuNet's vuAppAgent. This agent collects data based on the source configuration.
Logbeat agent is used to collect Tomcat logs.
Prerequisites
Dependent Configuration
To configure this O11ySource, create a 'credential' of type 'user' under the 'Definition' tab.
Inputs for Configuring Data Source
- Tomcat Server: The IP Address/FQDN of the Tomcat server. This field is the key to identify each server you add here.
- Period [in seconds]: How frequently data is gathered. The period should be between 60 seconds – 3000 seconds.
- Port: Provide the port details
- Application Name: Enter the Tomcat Application Name
- Credentials: This is optional
- Access Log Path: Enter the Tomcat access logfile's entire path
- Error Log Path: Enter the Tomcat error logfile's entire path.
- Catalina Log Path: Enter the Tomcat catalina logfile's entire path.
Firewall Requirement
To collect data from this O11ySource, ensure the following ports are opened:
Source IP | Destination IP | Destination Port | Protocol | Direction |
---|---|---|---|---|
IP address of the Tomcat server | vuSmartMaps Data Collector End Point | 9092* | TCP | Inbound |
*Before providing the firewall requirements, please update the port based on the customer environment.
Configuring the Target
Configure Metrics Collection from Tomcat Server
To monitor Apache Tomcat, the target JVM should enable Remote JMX. Set the following system property to enable remote JMX:
-Dcom.sun.management.jmxremote.port=(JMX port)
-Dcom.sun.management.jmxremote.rmi.port=(JMX port)
- Go to the path where Tomcat is installed and move to the bin directory
- Create a file as "setenv.sh"
- Modify the file using vi editor to add and save the following:
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=<port> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
- Change the file permission as executable - chmod 755 setenv.sh
- Restart Tomcat using sudo service tomcat restart or using the Tomcat bin directory (shutdown.sh & startup.sh)
Configure Logs Collection from Tomcat Server The Tomcat access log, error log, and catalina logs offer even more specific information about each client request, errors, and Tomcat-specific operations. Your Tomcat access logs can be customized to include information that is more pertinent to your requirements. Tomcat logs are collected by VuNet's Logbeat agent. We need to enhance the current logging format to include the request duration information. The %D variable precisely measures the time taken to handle each request in microseconds. To integrate %D into the log format used by Tomcat, you should make adjustments to your Tomcat configuration file. Typically, this file can be found in the httpd.conf or within dedicated configuration files used by Tomcat.
- Find your Tomcat configuration file, commonly named server.xml, and open it for editing. Then, search for the access_log directive, as this directive is responsible for defining the log format utilized by Tomcat.
- Modify the pattern to include %D. For example:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b %D" />
In the above example, we added %D to the end of the log format string.
Configuration Steps
Enable
the Tomcat O11ySource.- Select the Sources tab and press the
+
button to add a new Tomcat host to be monitored. - Set up metrics and log collection configurations. Afterwards, select
Save and Continue
to proceed with downloading the agents. - The following packages will be available for download based on the OS:Vuappagent Install Binary - Downloads the full vuAppAgent package with required configurations for a fresh installationVuappagent config update Install Binary - Downloads the agent configuration package to update an existing vuAppAgent installationLogbeat Install Binary - Downloads the full Logbeat package with required configurations for a fresh installationLogbeat config update Install Binary - Downloads the agent configuration package to update an existing Logbeat installation
- Download the agent installation or update package, then click
Finish
to close the data source window.
Metrics Collected
Name | Description | Data Type |
---|---|---|
@timestamp | Timestamp of the event | String |
timestamp | The precise timestamp when the data was recorded, including milliseconds. | DateTime64 |
target | IP Address of the Weblogic Server | String |
host | IP Address of the Weblogic Server | String |
tenant_id | Identifier for the specific tenant or customer in a multi-tenant environment. | LowCardinality(String) |
bu_id | Identifier for the business unit. | LowCardinality(String) |
vublock_name | Specifies the category or kind of entity or metric being referred to. | String |
topic_name | The total time that a server, application, or system has been operational and running without interruption | Float64 |
o11ysource_name | Specifies the category or kind of entity or metric being referred to. | String |
application_name | Name of the application that generated the log entry. | String |
allowLinking | Boolean flag indicating if linking is allowed for the specific resource. | Bool |
cachingAllowed | Boolean flag indicating if caching is allowed for the specific resource. | Bool |
sort | A floating-point value used to sort or prioritize entries. | Float64 |
KeyPropertyListType | represents a list of key-value pairs where each key identifies a specific property | String |
ErrorMessage | Error message related to the request or operation. | String |
stateName | Name of the current state of the resource or process. | LowCardinality(String) |
trackLockedFiles | Boolean flag indicating if locked files are being tracked. | Bool |
Status | Current status of the resource or process (e.g., success, failure). | LowCardinality(String) |
trackedResources | A list or description of resources being tracked. | String |
modelerType | Type or category of the modeler used for monitoring or metrics. | String |
SystemCpuLoad | CPU load on the system, represented as a floating-point value. | Float64 |
activeSessions | Number of currently active sessions. | Float32 |
maxActiveSessions | Maximum number of active sessions recorded. | UInt32 |
SystemLoadAverage | Average system load over a specific period. | Float64 |
TotalPhysicalMemorySize | Total physical memory available on the system. | Float64 |
ProcessCpuLoad | CPU load specifically for the process. | Float64 |
currentThreadCount | Name of the object associated with the log entry. | Float32 |
ObjectName | Maximum number of threads allowed for the application or process. | String |
maxThreads | Amount of heap memory currently in use. | Float32 |
HeapMemoryUsage_used | Maximum amount of heap memory that can be used. | UInt64 |
HeapMemoryUsage_max | Maximum amount of heap memory that can be used. | UInt64 |
HeapMemoryUsage_committed | Amount of heap memory committed for use. | UInt64 |
Usage_used | Memory usage amount for a specific resource or pool. | UInt64 |
Uptime | Uptime of the server or application in seconds. | Float64 |
NonHeapMemoryUsage_committed | Amount of non-heap memory committed for use. | UInt64 |
NonHeapMemoryUsage_max | The maximum amount of non-heap memory that can be used by the JVM. | UInt64 |
TotalLoadedClassCount | The total number of classes loaded by the JVM since the start. | UInt64 |
OpenFileDescriptorCount | The current number of open file descriptors by the Tomcat process. | UInt32 |
StackTrace | The stack trace captured at the point of error or during thread dumps. | String |
LockOwnerID | ID of the thread that owns a particular lock in the JVM. | Float32 |
BlockedCount | The number of times a thread has been blocked. | Float32 |
ThreadName | The name of the thread within the Tomcat server. | String |
BlockedTime | The total time (in milliseconds) a thread has been blocked. | Float32 |
locks | The list of locks held by the thread. | String |
WaitedCount | The number of times a thread has waited for a lock. | Float32 |
requestCount_diff | The difference in the request count between two monitoring periods. | Float32 |
errorCount_diff | The difference in the error count between two monitoring periods. | Float32 |
bytesReceived_rate | The rate at which bytes are being received by the server. | Float64 |
bytesSent_rate | The rate at which bytes are being sent by the server. | Float64 |
numActive_diff | The difference in the number of active sessions between two monitoring periods. | Float32 |
numActive_rate | The rate at which active sessions are changing. | Float32 |
LockName | The name of the lock currently held by the thread. | String |
WaitedTime | The total time (in milliseconds) a thread has waited for a lock. | String |
numIdle_diff | The difference in the number of idle threads between two monitoring periods. | Float64 |
numIdle_rate | The rate at which idle threads are changing. | Float64 |
CollectionCount | The number of times garbage collection has been performed. | Float64 |
CollectionCount_diff | The difference in the garbage collection count between two monitoring periods. | Float64 |
CollectionTime | The total time spent in garbage collection. | Float64 |
CollectionTime_diff | The difference in the garbage collection time between two monitoring periods. | Float64 |
hitCount | The number of cache hits during a specific period. | Float64 |
hitCount_diff | The difference in the cache hit count between two monitoring periods. | Float64 |
jspCount | The total number of JSP pages processed. | UInt32 |
gcStartTimestamp | The timestamp when garbage collection started. | String |
gcEndTimestamp | The timestamp when garbage collection ended. | String |
MemoryPoolName | The name of the memory pool managed by the JVM. | String |
LastGcInfo_duration | The duration of the last garbage collection event. | Float32 |
LastGcInfo_GcThreadCount | The number of threads involved in the last garbage collection event. | Float64 |
LastGcInfo_startTime | The start time of the last garbage collection event. | Float32 |
LastGcInfo_endTime | The end time of the last garbage collection event. | Float32 |
MemoryPoolNames_0 | Name of the first memory pool managed by the JVM. | String |
MemoryPoolNames_1 | Name of the second memory pool managed by the JVM. | String |
MemoryPoolNames_2 | Name of the third memory pool managed by the JVM. | String |
jspCount_diff | The difference in the JSP page processing count between two monitoring periods. | Float64 |
rejectedSessions | The number of sessions rejected by the server due to capacity limits. | UInt32 |
memoryUsageAfterGc_0_init | Initial memory usage after the first garbage collection event. | Float64 |
memoryUsageAfterGc_0_max | Maximum memory usage after the first garbage collection event. | Float64 |
memoryUsageAfterGc_0_used | Memory usage used after the first garbage collection event. | Float64 |
memoryUsageAfterGc_0_committed | Committed memory usage after the first garbage collection event. | Float64 |
memoryBeforeGc_0_init | Initial memory usage before the first garbage collection event. | Float64 |
memoryBeforeGc_0_committed | Amount of memory committed to memory pool 0 before the last garbage collection. | Float64 |
memoryBeforeGc_0_max | Maximum amount of memory available to memory pool 0 before the last garbage collection. | Float64 |
memoryBeforeGc_0_used | Amount of memory used in memory pool 0 before the last garbage collection. | Float64 |
source_id | Unique identifier for the data source, which might refer to a specific Tomcat instance or system. | String |
LoadedClassCount | Number of classes | UInt32 |
TotalLoadedCount | Total number of classes loaded by the JVM since startup. | UInt32 |
UnloadedClassCount | Number of classes that have been unloaded by the JVM. | UInt32 |
ThreadCount | Current number of threads in the Tomcat server. | UInt32 |
Type | The type of the object or resource being monitored (e.g., "thread," "class"). | String |
Name | The name of the object or resource (e.g., thread name, class name). | String |
TotalStartedThreadCount | Total number of threads started by the JVM since startup. | UInt32 |
PeakThreadCount | Peak number of threads active at any time since the JVM started. | UInt32 |
ThreadID | Unique identifier for the thread. | UInt32 |
ThreadState | The current state of the thread (e.g., "RUNNABLE," "WAITING"). | String |
NonHeapMemoryUsage_used | Amount of non-heap memory currently used by the JVM. | UInt64 |
@timestamp | The timestamp when the data was collected or recorded. | String |
timestamp | The specific time or date of the event or record. | DateTime64 |
http-code | The HTTP status code returned by Tomcat (e.g., 200, 404). | UInt16 |
tomcat_access_tat | The time taken to process a request (turnaround time). | Float32 |
tomcat_access_method | The HTTP method used (e.g., GET, POST). | String |
tomcat_access_remote_ip | The IP address of the client making the request. | String |
tomcat_access_url | The URL of the request received by Tomcat. | String |
geo_city_name | The city of the client making the request, based on geolocation. | String |
geo_country_name | The country of the client making the request, based on geolocation. | String |
geo_timezone | The timezone of the client making the request, based on geolocation. | String |
application_name | The name of the application being accessed or monitored. | String |
doc_type | The type of document or data being handled. | String |
vublock_name | Name of a specific virtual block or component in the system. | LowCardinality(String) |
topic_name | Name of the topic being monitored or processed. | LowCardinality(String) |
o11ysource_name | The name of the source for observability or monitoring data. | LowCardinality(String) |
target | The target resource or endpoint being accessed or monitored. | String |
host | The hostname of the Tomcat server or the host serving the application. | String |
scaled_uei | Scaled Unique Event Identifier for distinguishing events. | Float64 |
message | Log Messages | String |