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.

Prerequisites

  • Activate and upgrade ARMS
  • Ensure that the security group of the ECS instance that you use has the TCP outbound permission on the 8442, 8443, and 8883 ports. For more information about how to enable outbound permissions for ECS instances, see Add a security group rule.
    Note ARMS can access not only applications on the ECS, but also applications on other servers that can access the Internet.

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 an ARMS agent manually or by using scripts. This topic describes how to manually install an ARMS agent. This helps you better understand how to create an application monitoring job.

Step 1: Obtain a 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 Access Center panel, click Java. In the STEP2 section, obtain the license key.
    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 an ARMS agent for Java applications

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

  1. Run the wget command to download the package of an 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 an 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.