References > Template Reference > Tomcat Server

Tomcat Server

This template collects server resource information from an Apache Tomcat server by retrieving status information from the Tomcat status page. You can use the Orion agent for Linux or SNMP agentless to monitor.

Prerequisites

None.

Credentials

User with manager role. Tomcat users and roles can be configured in tomcat-users.xml file.

Example:
<role rolename="manager"/> <user username="user" password="pass" roles="manager"/>

Prerequisites for Orion Agent for Linux

If using the Orion Agent for Linux to monitor your Tomcat server, you need to complete installation and configuration of Tomcat to properly work with the component monitors working with the Tomcat Server template.

The following information walks through installing and configuring Tomcat servers to work with SAM component monitors. If you have Tomcat installed, you can skip to step 4 to create an account used for polling.

  1. Determine the version of Tomcat you want to install. You may have multiple versions available to install. To locate all versions, use this command:
    yum search tomcat
  2. After determining the version, you can install the tomcat package and the admin webapps package. Locate the versions to install from the search results. For example:
    tomcat5.i386 : Apache Servlet/JSP Engine, RI for Servlet 2.4/JSP 2.0 API
    tomcat5-admin-webapps.i386 : The administrative web applications for Jakarta Tomcat
  3. Install the versions using the located versions. To install the example above:
    yum install tomcat5 tomcat5-admin-webapps
  4. Next, you need to modify the tomcat-users.xml file to create and provide a user account to access the web manager ('manager','manager-gui'). To locate, use this command:
    find /etc -iname tomcat-users.xml
  5. Edit the file and locate the <tomcat-users> section. If commented out, uncomment the configuration. Edit to add a user of tomcat with the password of tomcat. The template uses this account to access data.
    <tomcat-users>
    <user name="tomcat" password="tomcat" roles="tomcat,manager,manager-gui" />
    <user name="role1"  password="tomcat" roles="role1"  />
    <user name="both"   password="tomcat" roles="tomcat,role1" />
    </tomcat-users>
  6. Restart the service. The command depends on the version you installed. For example, this command restarts the installed service above:
    service tomcat5 restart

Monitored Components

For details on monitors, see SAM Component Monitor Types.

You need to set thresholds for counters according to your environment. It is recommended to monitor counters for some length of time to understand potential value ranges and then set the thresholds accordingly.

By default all components use port 8080. If your Tomcat server uses another port, you should manually change the Port Number field in all components.

Tomcat Free Memory

This monitor returns the amount of heap space currently available to the Java Virtual Machine. This value should be as high as possible. The heap space may be of a fixed size or may be expanded and shrunk, depending on the garbage collector's strategy. More information can be found here: http://javarevisited.blogspot.com/2011/05/java-heap-space-memory-size-jvm.html.

Tomcat Total Memory

This monitor returns the total amount of memory currently allocated to the Java Virtual Machine heap space. This value should be as low as possible. You should set thresholds according to your Tomcat Max Memory value. If the returned value is near the Tomcat Max Memory value or you received OutOfMemoryError errors, you may need to increase the heap size. More information can be found here: http://javarevisited.blogspot.com/2011/05/java-heap-space-memory-size-jvm.html.

Tomcat Max Memory

This monitor returns the maximum size of the heap space, not including the permanent generation area.

Tomcat Total Processing Time

This monitor returns the total processing time, in milliseconds, since the server started.

Tomcat Total Request Count

This monitor returns the total number of requests from the server since the server started.

Tomcat Total Bytes Sent

This monitor returns the total number of bytes sent from the server since the server started.

Tomcat Total Bytes Received

This monitor returns the total number of bytes sent to the server since the server started.

Tomcat Total Errors Count

This monitor returns the total number of errors from all request processors.