Extended Monitoring Guide

  • Docs Home
  • Community Home

3. Enable Monitoring

3.1. Configuring Tomcat to Allow JMX Queries

Before running the Tomcat bin/start.sh script, run the following to allow unsecured queries against the Tomcat server:

JAVA_OPTS="-Dcom.sun.management.jmxremote.port=12346"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"
export JAVA_OPTS

The same JAVA_OPTS approach can be used to enable remote access to Tomcat MBeans. Set the JAVA_OPTS variable as illustrated above and then execute the ./catalina.sh start command in the ${TOMCAT_HOME}/bin directory.

Note

Tomcat 6.0.14's catalina.sh does not process the stop command properly when the JAVA_OPTS variable is set. We recommend using two separate shell scripts when troubleshooting JMX problems in Tomcat: one for starting Tomcat (with the JAVA_OPTS variable set) and a different one for stopping Tomcat (where the JAVA_OPTS variable is not set).

If you add the above lines to the to bin/setenv.sh (as seems to be the logical thing to do in catalina.sh to get the environment variables set up), the bin/shutdown.sh script will get those same environment variables. This will cause the shutdown.sh script to attempt to bind to the ports, fail, and then not stop Apache Tomcat.

3.2. Configuring Zenoss

All Apache Tomcat services must have a device entry under the /Devices/Server/Tomcat device class.

Note

The zenjmx daemon must be configured and running. See Section 2.1, “Sun Java Runtime Environment (JRE)” for more information about configuring the zenjmx daemon with the Sun JRE tools.

  1. Navigate to the device or device class under the /Devices/Server/Tomcat device class in the Zenoss web interface.

  2. If applying changes to a device, click the page menu, then select MorezProperties.

    If applying changes to a device class, click the zProperties tab.

  3. Edit the appropriate zProperties for the device or devices.

    Table 18.2. Tomcat zProperties

    NameDescription

    zTomcatJ2EEApplicationName

    Used to construct MBean names for a specific application deployed on Tomcat, typically used for JSP and Servlet statistics.

    zTomcatJ2EEServerName

    Used to construct MBean names for a specific application deployed on Tomcat, typically used for JSP and Servlet statistics.

    zTomcatJmxManagementAuthenticate

    This zProperty is deprecated.

    zTomcatJmxManagementPassword

    JMX password.

    zTomcatJmxManagementPort

    The port number used to gather JMX information.

    zTomcatJmxManagementUsername

    JMX username for authentication.

    zTomcatListenHost

    The hostname on which Tomcat is listening for web requests. This is used to construct MBean names.

    zTomcatListenPort

    The Tomcat connector, which is a port and protocol (http, jk...) that Tomcat is listening on. This is used to construct MBean names that monitor bytes, error and requests on that connector.

    zTomcatServletName

    Specific Servlet name to monitor.

    zTomcatServletUri

    URI of Servlet to monitor.

    zTomcatWebAppUri

    URI path for a Tomcat web application. Used to construct MBean names.


  4. Click Save to save your changes.

    You will now be able to start collecting the Tomcat server metrics from this device.

  5. Navigate to the Perf tab and you should see some placeholders for graphs. After approximately 15 minutes you should see the graphs start to become populated with information.

Tip

The out-of-the-box TomcatMonitor data source configuration has been defined at the macro level, but can be configured to operate on a more granular basis. For example, the Servlet Reload Count applies to all servlets in all web applications but it could be narrowed to be Servlet /submitOrder in web application "production server".