Command-line options to enabling Application Performance Monitoring for Tomcat

This post will go over the specifics of running the command-line options for enabling the Java Application Performance Monitoring (APM) agent with a Tomcat server.  This is not coverage of the full System Center Operations Manager (SCOM) setup (please refer to the documentation), rather the details about how to enable the Java APM agent. Of course, it should be mentioned that it is assumed prior to starting you have obtained the ZIP file APM-Java-Agent-*.zip (which can be obtained via a Task in SCOM Console for the application server provided by the the Java APM Management Packs).

In order to get APM data, the java process needs to be started with some additional command-line arguments to inform it that a monitoring agent in available.  As per the documentation in java.lang.instrument, the java process needs to start with the additional command-line argument -javaagent.  

For Window, the suggested modifications to the catalina.bat script would look like:

 :noJuliManager 
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%

set APM_DIR=\path\to\apm\agent\zip\contents
set APM_OPTS=-Djava.library.path="%APM_DIR%" -javaagent:"%APM_DIR%\apm_facade.jar" -Xbootclasspath/p:"%APM_DIR%\apm_facade.jar" -Xbootclasspath/p:"%APM_DIR%\apm_producers.jar"
set JAVA_OPTS=%JAVA_OPTS% %APM_OPTS%
 
rem ----- Execute The Requested Command ---------------------------------------

  

For Linux, the suggested modifications to the catalina.sh script would look like:

 if [ -z "$LOGGING_MANAGER" ]; then
 JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
else
 JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER"
fi
 
APM_DIR=/path/to/apm/agent/zip/contents 
APM_OPTS="-javaagent:$APM_DIR/apm_facade.jar -Xbootclasspath/p:$APM_DIR/apm_producers.jar -Xbootclasspath/p:$APM_DIR/apm_facade.jar"
JAVA_OPTS="$JAVA_OPTS $APM_OPTS"

# ----- Execute The Requested Command -----------------------------------------