Application Monitoring of Application Real-Time Monitoring Service (ARMS) provides features such as application trace analytics, local stack diagnostics, and business log troubleshooting. To monitor an application by using Application Monitoring, you must create an application monitoring job.

Background information

Application Monitoring can monitor Java applications that run in various environments. This topic describes how to create an application monitoring job to monitor a Java application that runs on an Elastic Compute Service (ECS) instance in the Tomcat environment. To ensure that you can monitor applications in different environments, ARMS allows you to install the ARMS agent manually or by using scripts. This topic describes how to manually install the ARMS agent. This helps you better understand how to create an application monitoring job.

Prerequisites

  • Activate and upgrade ARMS
  • Make sure that the security group of your ECS instance has opened the TCP outbound permission of ports 8442, 8443, and 8883. For more information about how to open outbound permissions for ECS, see Add a security group rule.
    Note ARMS can be connected to not only applications on ECS, but also applications on other servers that can access the Internet.

Step 1: Obtain the license key

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications.
  2. On the Applications page, select a region in the top navigation bar, and click Access applications.
  3. In the Backend Applications section of the Integration Center panel, click Java. Manually install the ARMS agent for a Java application
  4. In the upper-right corner of the Integrate Java panel, select the region where you want to install the ARMS agent.
  5. Obtain the license key in the STEP2 section. Section LicenseKey

Step 2: Configure the Tomcat runtime environment

Perform the following steps to configure the Tomcat runtime environment and set the required parameters in the configuration file:

  1. Open the {TOMCAT_HOME}/bin/catalina.sh configuration file.
    Note If your Tomcat does not contain the catalina.sh configuration file, find and open the {TOMCAT_HOME}/bin/setenv.sh configuration file.
  2. Add the following configurations to the configuration file:
    Note Replace <licenseKey> in the following sample code with the license key that you obtained in Step 1. Replace <appName> with the name of your application.
    JAVA_OPTS="$JAVA_OPTS -javaagent:/workspace/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar -Darms.licenseKey=<licenseKey> -Darms.appName=<appName>"
                        

The following sample code shows how to configure the Tomcat runtime environment:

Step 3: Install the ARMS agent for Java applications

Perform the following steps to install the ARMS agent for Java applications and collect the monitoring data that you need:

  1. Run the wget command to download the package of the ARMS agent for Java applications.
    Note In this example, the package is downloaded in the China (Hangzhou) region. For more information about how to download the package in other regions, see Manually install the ARMS agent for a Java application.
    # China (Hangzhou)
    wget "http://arms-apm-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
  2. Decompress the package to a working directory. In this example, the working directory is workspace.
    unzip ArmsAgent.zip -d /workspace/

The following sample code shows how to install the ARMS agent for Java applications:

Step 4: Restart Tomcat

  1. Go to the {TOMCAT_HOME}/bin directory.
  2. Restart Tomcat.
    ./startup.sh

The following sample code shows how to restart Tomcat:

Check the result

After 2 to 3 minutes, log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Applications. If your application (specified by the <appName> parameter) appears on the Applications page, it indicates that the application monitoring job is created.