Enabling Java Business Transaction Monitoring for Jetty

The steps for enabling BTM for Jetty server will differ based on where the eG agent monitoring Jetty has been deployed - whether on the Jetty server, or on a remote host.

Agent-based Approach to Deploying eG Java BTM on Jetty

If Jetty server is monitored in an agent-based manner, then follow the steps below to BTM-enable the Jetty server:

  1. Login to the system hosting Jetty server.
  2. Open a browser on the node, connect to the eG manager, and login to the eG admin interface.
  3. Manage Jetty as a separate component using the eG administrative interface. When managing, make sure you leave the Agentless flag unchecked.
  4. If multiple Jetty instances are operating on a single node, and you want to BTM-enable all the instances, then you will have to manage each instance as a separate component using the eG administrative interface.
  5. Next, follow the Agents -> BTM Profiler Settings menu sequence in the eG admin interface. Figure 1 will then appear, listing the Java application servers managed in the environment. Locate the Jetty server that you managed recently in that list, and click the Copy JVM icon () corresponding to it (see Figure 1).

    Figure 1 : Clicking the Copy JVM option corresponding to the Jetty component managed in an agent-based manner

  6. Figure 2 will then appear. Copy the JVM option displayed in Figure 2 to the clip board or any text editor.

    Figure 2 : Copying the JVM option displayed in the admin interface to a clip board or text editor

  7. You can enable BTM for Jetty server either by adding JVM option in BTM JAR file location or by adding JVM option with JMX system properties in the command line as discussed in following sections below.

    Enabling BTM by adding JVM option in BTM JAR file location

    To enable eG BTM for Jetty server, add the copied JVM option in the location of the eG_BTM JAR file. After adding the copied JVM option, make sure that you replace the <<EGURKHA_AGENT_HOME>> tag in the copied code block with the actual install directory of the eG agent deployed on the system hosting Jetty server. In Windows Operating System, the command line with the added JVM option appears as shown below:

    java -javaagent:C:/eGurkha/lib/apm/Java/default/eg_btm.jar=component_
    guid=za4jvzvybs7d4s74hdsgjbmjalcbd2hx:6a09908c-1db0-49a3-aa6d-b0d3fdef300e -jar
    <<JETTY_HOME>>/start.jar

  8. In Linux Operating System, the command line with the added JVM option appears as shown below:

    java -javaagent: /opt/egurkha/lib/apm/Java/default/eg_btm.jar==component_guid=za4jvzvybs7d4s74hdsgjbmjalcbd2hx:6a09908c-1db0-49a3-aa6d-b0d3fdef300e -jar $JETTY_HOME/start.jar

     

    Enabling BTM by adding JVM option with JVM property

    By default, the JVM settings for Jetty instance are stored in the following command line: <<JETTY_HOME>>/start.d/jvm.ini. If the JVM settings are available, then copy the same from that path and append it in <JETTY_BASE> Directory location or create a new “jvm.ini” file in <JETTY_BASE> Directory location as shown below.

    <<JETTY_BASE>>/start.d/jvm.ini

    To enable eG BTM for Jetty server, append the copied JVM option after the JVM property “--exec”. If the JVM property is not available, then you need to manually append JVM property “--exec” before the copied JVM option.

    In Windows Operating System, the modified command line after adding the copied JVM option is shown below:

    ## JVM Configuration

    --exec

    -javaagent:C:/eGurkha/lib/apm/Java/default/eg_btm.jar=component_guid=za4jvzvybs7d4s74hdsgjbmjalcbd2hx:64b6fea6-e84f-4bfb-b8a1-36dfd88b0877

    In Linux Operating System, the modified command line after adding the copied JVM option is shown below:

    ## JVM Configuration

    --exec

    -javaagent:/opt/egurkha/lib/apm/Java/default/eg_btm.jar=component_guid=za4jvzvybs7d4s74hdsgjbmjalcbd2hx:64b6fea6-e84f-4bfb-b8a1-36dfd8814587

Agentless Approach to Deploying eG Java BTM on Jetty Server

If Jetty server is monitored in an agentless manner, then follow the steps below to BTM-enable that Jetty server:

  1. Login to the system hosting Jetty server.
  2. Open a browser on the node, connect to the eG manager, and login to the eG admin interface.
  3. Manage Jetty server as a separate component using the eG administrative interface. When managing, make sure you enable the Agentless flag.
  4. If multiple instances of Jetty are operating on a single node, and you want to BTM-enable all the instances, then you will have to manage each instance as a separate component using the eG administrative interface. When doing so, make a note of the Nick name and Port number using which you managed each instance.
  5. Next, log out of the eG admin interface. Then, create a btm directory anywhere on the system hosting Jetty - say, C:\btm (if the target node is operating on a Windows system), or /opt/btm (if the target node is operating on a Unix system). Under this directory, create a sub-folder. Make sure that you name this sub-folder in the following format: <Managed_Component_NickName>_<Managed_Component_Port>. For instance, if you have managed Jetty using the nick name Jetty1 and the port number 8080, the new directory under the btm directory should be named as Jetty1_8080.
  6. If you have managed multiple Jetty instances running on a single node, then you will have to create multiple sub-directories under the btm directory - one each for every instance. Each of these sub-directories should be named after the Nick name and Port number using which the corresponding instance has been managed in eG.

  7. Once the new sub-directory(ies) is created, open a browser on the system hosting Jetty, connect to the eG manager, and login to the eG admin interface again.
  8. Follow the Agents -> BTM Profiler Settings menu sequence in the eG admin interface.
  9. Figure 3 will appear listing the servers that can be instrumented for APM by eG. In this list, locate the Jetty component you want to BTM-enable. Once you locate component, click the Download icon corresponding to that node to download the APM Profiler Agent to that node. If multiple JVM instances on a single node are managed, then you will have to download the APM Profiler Agent separately for each of the managed instances.

    Figure 3 : Downloading the APM Profiler Agent for Jetty

  10. Upon clicking the Download icon in Figure 3, a zip file named javaagent_<Nick_name_of_JVM_node>_<Port_number_of_JVM_node will get downloaded. For instance, if you have managed Jetty using the nickname 'Jetty1' and the port number '8080', then the name of the zip file will be javaagent_Jetty1_8080. Where multiple Jetty instances have been managed, you will be downloading multiple zip files - one each for every instance. The names of these zip files will automatically carry the nick name and port number you assigned to the corresponding instance.
  11. Copy the downloaded zip file(s) to the corresponding sub-directory(ies) of the btm directory (see step 6 above).  For example, the zip file named javaagent_Jetty1_8080, should be copied to the D:\btm\Jetty1_8080 directory (on Windows) or /opt/btm/Jetty1_8080 (on Unix).
  12. Extract the contents of each zip file into the same sub-directory to which that zip file was copied.
  13. Figure 4 depicts the extracted contents of the zip file.

    Figure 4 : Contents of the APM Profiler Agent zip

  14. From Figure 4, it is evident that the zip file contains an eg_btm.jar file and a few property files, namely - btmOther.props, btmLogging.props, config.props, custom.props, exclude.props, and autodiscovery.props files.
  15. You can enable BTM for Jetty server either by adding JVM option in BTM JAR file location or by adding JVM option with JMX system properties in the command line as discussed in following sections below.

    Enabling BTM by adding JVM option in BTM JAR file location

    To enable eG BTM for Jetty server, add the extracted JVM option in the location of the eG_BTM JAR file.

    In Windows Operating System, the modified command line after adding the copied JVM option is shown below:

    java -javaagent: D:\base_environment\app_servers\jetty\javaagent_jettydemo2_8080\eg_btm.jar -jar <<JETTY_HOME>>/start.jar

  16. In Linux Operating System, the modified command line after adding the copied JVM option is shown below:

    java -javaagent: /home/apm/javaagent_jettydemo2_8080/eg_btm.jar -jar $JETTY_HOME/start.jar

     

    Enabling BTM by adding JVM option with JVM property

    By default, the JVM settings for Jetty instance are stored in the following path: <<JETTY_HOME>>/start.d/jvm.ini. If the JVM settings are available, then copy the same from the path and append it in <JETTY_BASE> Directory location or create a new “jvm.ini” file in <JETTY_BASE> Directory location as shown below.

    <<JETTY_BASE>>/start.d/jvm.ini

    To enable eG BTM for Jetty server, append the copied JVM option (as mentioned in step 6) after the JVM property “--exec”. If the JVM property is not available, then you need to manually append JVM property “--exec” before the copied JVM option.

    In Windows Operating System, the command line with the added JVM option appears as shown below:

    ## JVM Configuration

    --exec

    -javaagent:D:\base_environment\app_servers\jetty\javaagent_jettydemo2_8080\eg_btm.jar

    In Linux Operating System, the command line with the added JVM option appears as shown below:

    ## JVM Configuration

    --exec

    -javaagent:/home/apm/javaagent_jettydemo2_8080/eg_btm.jar