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

  1. 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
  1. 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"
  1. 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 MetricMetric Display NameUnitDescription
tomcat_maxThreadsMax ThreadsthreadsMaximun Number of threads created
tomcat_currentThreadCountCurrent Thread CountthreadsNumber of threads currently active
tomcat_currentThreadsBusyCurrent Threads BusythreadsNumber of busy threads
tomcat_jspCountJsp CountNumber of times JSPs were accessed on all the applications
tomcat_jspReloadCountJsp Reload CountNumber of times JSPs were reloaded on all the applications
tomcat_Servlet_requestCountServlet RequestcountRequestsNumber of requests served by the servlet
tomcat_Servlet_errorCountServlet ErrorcountErrorsNumber of erroneous requests received by the servlet
tomcat_Servlet_processingTimeServlet ProcessingtimeProcessing TimeAmount of processing time taken
tomcat_bytesSentBytes SentmegabytesMegabytes sent by all the request processors running on the Apache Tomcat
tomcat_bytesReceivedBytes ReceivedmegabytesMegabytes received by all the request processors running on the Apache Tomcat
tomcat_errorCountError CountErrorsErrors on all the request processors running on the Apache Tomcat
tomcat_requestCountRequest CountRequestsRequests on all the request processors running on the Apache Tomcat
tomcat_maxTimeMax TimemillisecondsThe longest request processing time in milliseconds
tomcat_processingTimeProcessingtimeProcessing TimeAmount of processing time taken
tomcat_jvm_HeapMemoryUsage_commitedJvm Heap Memory Usage CommitedmegabytesHeap memory committed in MB for the server
tomcat_jvm_HeapMemoryUsage_usedJvm Heap Memory Usage UsedmegabytesHeap memory usage in MB of the server
tomcat_jvm_NonHeapMemoryUsage_commitedJvm Non Heap Memory Usage CommitedmegabytesNon heap memory committed in MB for the server
tomcat_jvm_NonHeapMemoryUsage_usedJvm Non Heap Memory Usage UsedmegabytesNon heap memory usage in MB of the server
tomcat_jvm_OpenFileDescriptorCountJvm Open File Descriptor CountOpen FDsNumber of Open file descriptors of the server
tomcat_jvm_ThreadCountJvm ThreadcountthreadsNumber of threads
tomcat_jvm_UptimeJvm UptimeMinutesUptime of the server
tomcat_Cache_accessCountCache AccesscountAccessesNumber of times the cache was accessed
tomcat_cache_hitsCountCache HitscountHitsNumber of times the cache was hit
tomcat_StringCache_hitsCountString Cache HitscountAccessesThe number of string cache hits
tomcat_StringCache_accessCountString Cache AccesscountHitsThe number of accesses to the string cache
tomcat_activeSessionsActive SessionsSessionsNumber of active sessions to the server