Apache Tomcat, often referred to as Tomcat Server, is an open-source Java Servlet Container developed by the Apache Software Foundation (ASF). Tomcat implements several Java EE specifications including Java Servlet, JavaServer Pages (JSP), Java EL, and WebSocket, and provides a “pure Java” HTTP web server environment in which Java code can run.
Tomcat is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation, released under the Apache License 2.0 license, and is open-source software.
Prerequisites
- For standard installation of Tomcat (extracting the tar), add the following in the
~/.bashrc
file:
export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 #add this line where jvm is installed on the machine
export export CATALINA_HOME=/opt/tomcat/apache-tomcat-7.0.105 #add this line where the extracted directory is present
- Create a file
setenv.sh
, add the following lines, and execute the file before you start the Tomcat server:
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7199 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
- For Virtual Machines, install the Linux Agent.
Configuring the credentials
Configure the credentials in the directory /opt/opsramp/agent/conf/app.d/creds.yaml
tomcat:
- name: tomcat
user: <username>
pwd: <Password>
encoding-type: plain
labels:
key1: val1
key2: val2
Configuring the application
Virtual machine
Configure the application in the directory /opt/opsramp/agent/conf/app/discovery/auto-detection.yaml
- name: tomcat
instance-checks:
process-check:
- tomcat
port-check:
- 8080
mon-type: "jmx"
misc:
jmx-port: "7199"
Docker environment
Configure the application in the directory /opt/opsramp/agent/conf/app/discovery/auto-container-detection.yaml
- name: tomcat
container-checks:
image-check:
- tomcat
port-check:
- 8080
mon-type: "jmx"
misc:
jmx-port: "7199"
Kubernetes environment
Configure the application in config.yaml
- name: tomcat
container-checks:
image-check:
- tomcat
port-check:
- 8080
mon-type: "jmx"
misc:
jmx-port: "7199"
Validate
Go to Resources under the Infrastructure tab to check if your resources are onboarded and the metrics are collected.
Metrics
OpsRamp Metric | Metric Display Name | Unit | Description |
---|---|---|---|
tomcat_maxThreads | Max Threads | threads | Maximun Number of threads created |
tomcat_currentThreadCount | Current Thread Count | threads | Number of threads currently active |
tomcat_currentThreadsBusy | Current Threads Busy | threads | Number of busy threads |
tomcat_jspCount | Jsp Count | Number of times JSPs were accessed on all the applications | |
tomcat_jspReloadCount | Jsp Reload Count | Number of times JSPs were reloaded on all the applications | |
tomcat_Servlet_requestCount | Servlet Requestcount | Requests | Number of requests served by the servlet |
tomcat_Servlet_errorCount | Servlet Errorcount | Errors | Number of erroneous requests received by the servlet |
tomcat_Servlet_processingTime | Servlet Processingtime | Processing Time | Amount of processing time taken |
tomcat_bytesSent | Bytes Sent | megabytes | Megabytes sent by all the request processors running on the Apache Tomcat |
tomcat_bytesReceived | Bytes Received | megabytes | Megabytes received by all the request processors running on the Apache Tomcat |
tomcat_errorCount | Error Count | Errors | Errors on all the request processors running on the Apache Tomcat |
tomcat_requestCount | Request Count | Requests | Requests on all the request processors running on the Apache Tomcat |
tomcat_maxTime | Max Time | milliseconds | The longest request processing time in milliseconds |
tomcat_processingTime | Processingtime | Processing Time | Amount of processing time taken |
tomcat_jvm_HeapMemoryUsage_commited | Jvm Heap Memory Usage Commited | megabytes | Heap memory committed in MB for the server |
tomcat_jvm_HeapMemoryUsage_used | Jvm Heap Memory Usage Used | megabytes | Heap memory usage in MB of the server |
tomcat_jvm_NonHeapMemoryUsage_commited | Jvm Non Heap Memory Usage Commited | megabytes | Non heap memory committed in MB for the server |
tomcat_jvm_NonHeapMemoryUsage_used | Jvm Non Heap Memory Usage Used | megabytes | Non heap memory usage in MB of the server |
tomcat_jvm_OpenFileDescriptorCount | Jvm Open File Descriptor Count | Open FDs | Number of Open file descriptors of the server |
tomcat_jvm_ThreadCount | Jvm Threadcount | threads | Number of threads |
tomcat_jvm_Uptime | Jvm Uptime | Minutes | Uptime of the server |
tomcat_Cache_accessCount | Cache Accesscount | Accesses | Number of times the cache was accessed |
tomcat_cache_hitsCount | Cache Hitscount | Hits | Number of times the cache was hit |
tomcat_StringCache_hitsCount | String Cache Hitscount | Accesses | The number of string cache hits |
tomcat_StringCache_accessCount | String Cache Accesscount | Hits | The number of accesses to the string cache |
tomcat_activeSessions | Active Sessions | Sessions | Number of active sessions to the server |