Monitoring Tomcat 5.0 on Ubuntu - Page 2

2 Setup Tomcat for Monitoring

To enable monitoring of Tomcat servers and services the Tomcat server must be instrumented using a filter to collect metrics and a webapp to deliver the metric data into HQ. The web application, filter and any additional jars are packaged in the HQ agent directory under product_connectors/servlet-n.n.n

2.1 Set Apache/JK Mount Point

If you are using Apache/JK to front your Tomcat installation you will need to setup a mount point. This can be done by adding the following to your Apache configuration /etc/apache2/conf.d/jk file. You can find an example in /usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf.

JkMount /hyperic-hq/* ajp13_worker

2.2 Secure Your Installation

Keep in mind that depending on how you configured your Apache the whole world can access the hyperic webapp! Secure your setup by using the following example:

Order Deny,Allow
Deny from all
Allow from localhost
Allow from iphyperichq

2.3 Enable Tomcat for Monitoring

The first step to making Tomcat monitorable is to install the filter, JMX jars and webapp. These are used to collect internal Tomcat metrics.

cp libs/hq-filter.jar /usr/lib/tomcat5/common/lib
cp libs/mx4j-jmx.jar /usr/lib/tomcat5/common/lib
cp -R hyperic-hq /usr/lib/tomcat5/webapps

In fact you can copy your files also to /usr/share/tomcat5/ which is a symbolic link to /usr/lib/tomcat5/.

Finally, the filter must be enabled. The following must be added to /etc/tomcat5/web.xml. Keep in mind that each tag type must be grouped together:


<!– Uncomment the following line to enable response time logging.
The directory you specify as the param can include properties
referenced from the of the vm.

The ResponseTime log file will by default store the last 1 hour’s
worth of response time data. This file gets truncated as soon as
data is succesfully sent into the server. The file is named uniquely
for each webapp in the form: yourContextName_HQResponseTime.log

If this fragment is included in the global web.xml for the container,
all webapps in it will generate response time data, and have logs
following the format described above. You can enable it individually
on each webapp as well if you dont want every webapp to generate
response time data


<!– these are optional parameters which you can override to optimize logging –>





This can be tested by verifying your webapps show up correctly in the JMX Servlet. You may need to modify the hostname in the URL if your jmxUrl is configured relative to the agent host or if you use Apache in front of your Tomcat-Installation as described above.

Share this page:

Suggested articles

0 Comment(s)

Add comment


By: staceyeschneider