All Products
Search
Document Center

Application Real-Time Monitoring Service:Manually install an ARMS agent

Last Updated:Nov 21, 2024

After you install an Application Real-Time Monitoring Service (ARMS) agent for a Java application, ARMS starts to monitor the Java application. Then, you can view the monitoring data of the Java application, such as the application topology, traces, abnormal transactions, slow transactions, and SQL analysis. This topic describes how to manually install an ARMS agent for a Java application.

Note

For applications deployed in Container Service for Kubernetes (ACK) clusters, we recommend that you install the ack-onepilot component rather than manually install an ARMS agent. For more information, see Automatically install an ARMS agent in ACK and Automatically install an ARMS agent in an open source Kubernetes cluster.

Prerequisites

Install an ARMS agent

  1. Log on to the ARMS console. In the left-side navigation pane, click Integration Center.

  2. Click the Java Application Monitor card. In the panel that appears, select Manual Installation.

  3. Download an ARMS agent.

    • Method 1: Manually download an ARMS agent. In the Java Application Monitor panel, download an ARMS agent as prompted.

    • Method 2: Run the wget command. Download the installation package based on your region.

      wget commands in different regions

      Region

      Public URL

      VPC

      China (Hangzhou)

      wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Shanghai)

      wget "http://arms-apm-cn-shanghai.oss-cn-shanghai.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-shanghai.oss-cn-shanghai-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Qingdao)

      wget "http://arms-apm-cn-qingdao.oss-cn-qingdao.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-qingdao.oss-cn-qingdao-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Beijing)

      wget "http://arms-apm-cn-beijing.oss-cn-beijing.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-beijing.oss-cn-beijing-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Zhangjiakou)

      wget "http://arms-apm-cn-zhangjiakou.oss-cn-zhangjiakou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-zhangjiakou.oss-cn-zhangjiakou-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Hohhot)

      wget "http://arms-apm-cn-huhehaote.oss-cn-huhehaote.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-huhehaote.oss-cn-huhehaote-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Ulanqab)

      wget "http://arms-apm-cn-wulanchabu.oss-cn-wulanchabu.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-wulanchabu.oss-cn-wulanchabu-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Shenzhen)

      wget "http://arms-apm-cn-shenzhen.oss-cn-shenzhen.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-shenzhen.oss-cn-shenzhen-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Heyuan)

      wget "http://arms-apm-cn-heyuan.oss-cn-heyuan.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-heyuan.oss-cn-heyuan-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Guangzhou)

      wget "http://arms-apm-cn-guangzhou.oss-cn-guangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-guangzhou.oss-cn-guangzhou-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Chengdu)

      wget "http://arms-apm-cn-chengdu.oss-cn-chengdu.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-chengdu.oss-cn-chengdu-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China (Hong Kong)

      wget "http://arms-apm-cn-hongkong.oss-cn-hongkong.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-hongkong.oss-cn-hongkong-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      Singapore

      wget "http://arms-apm-ap-southeast-1.oss-ap-southeast-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-ap-southeast-1.oss-ap-southeast-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      Malaysia (Kuala Lumpur)

      wget "http://arms-apm-ap-southeast-3.oss-ap-southeast-3.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-ap-southeast-3.oss-ap-southeast-3-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      Indonesia (Jakarta)

      wget "http://arms-apm-ap-southeast-5.oss-ap-southeast-5.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-ap-southeast-5.oss-ap-southeast-5-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      Japan (Tokyo)

      wget "http://arms-apm-ap-northeast-1.oss-ap-northeast-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-ap-northeast-1.oss-ap-northeast-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      Germany (Frankfurt)

      wget "http://arms-apm-eu-central-1.oss-eu-central-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-eu-central-1.oss-eu-central-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      UK (London)

      wget "http://arms-apm-eu-west-1.oss-eu-west-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-eu-west-1.oss-eu-west-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      US (Virginia)

      wget "http://arms-apm-us-east-1.oss-us-east-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-us-east-1.oss-us-east-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      US (Silicon Valley)

      wget "http://arms-apm-us-west-1.oss-us-west-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zipwget "http://arms-apm-us-west-1.oss-us-west-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-us-west-1.oss-us-west-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China East 1 Finance

      None

      wget "http://arms-apm-cn-hangzhou-finance.oss-cn-hzjbp-b-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China East 2 Finance

      None

      wget "http://arms-apm-cn-shanghai-finance-1.oss-cn-shanghai-finance-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China South 1 Finance

      None

      wget "http://arms-apm-cn-shenzhen-finance-1.oss-cn-shenzhen-finance-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip

      China North 2 Ali Gov

      wget "http://arms-apm-cn-north-2-gov-1.oss-cn-north-2-gov-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
      wget "http://arms-apm-cn-north-2-gov-1.oss-cn-north-2-gov-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
  4. Decompress the installation package.

    Go to the directory of the installation package. Run the following command to decompress the installation package to a working directory:

    unzip ArmsAgent.zip -d /{user.workspace}/ 
    Note

    {user.workspace} is a sample directory. Replace the sample directory with the actual directory.

  5. Add the AppName and LicenseKey parameters.

    Obtain a license key in the Java Application Monitor panel. AppName specifies the application that is integrated into ARMS. Enter a custom application name based on your needs. In a distributed architecture, an application can contain multiple peer application instances.

    Use one of the following methods to add the AppName and LicenseKey parameters.

    • Method 1: Replace the {LicenseKey} parameter with the license key obtained from the console and replace the {AppName} parameter with the application name.

    • Method 2: Do not specify the LicenseKey and AppName parameters in the script. Add the following configurations to the arms-agent.config file of the installation package.

      arms.licenseKey={LicenseKey} 
      arms.appName={AppName}
  6. Add the script.

    Replace {user.workspace} with the directory to which the ARMS agent is decompressed. Replace demoApp.jar with the path to the actual JAR package.

    Note
    • If you use an ARMS agent earlier than 2.7.3.5, replace aliyun-java-agent.jar in the preceding code with arms-bootstrap-1.7.0-SNAPSHOT.jar. We recommend that you upgrade the agent to the latest version at the earliest opportunity.

    • In Windows, replace / in the script with \ and replace the .sh file with the .bat file.

    • The ARMS agent V2.7.1.4 allows you to activate Application Security when you connect your application to Application Monitoring. If you need to activate Application Security, add -Darms.appsec.enable=true in the script. For information about the billing rules of Application Security, see Billing rules.

    Runtime environment

    Procedure

    Spring Boot applications or other Java applications started by running the java -jar command

    Append the -javaagent parameter to the startup command. Make sure that the -javaagent parameter is written before the -jar parameter.

    java -javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar -Darms.licenseKey={LicenseKey} -Darms.appName={AppName} -jar demoApp.jar

    Tomcat

    Append the following configurations to the {TOMCAT_HOME}/bin/setenv.sh file:

    JAVA_OPTS="$JAVA_OPTS -javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar -Darms.licenseKey={LicenseKey} -Darms.appName={AppName} " 

    If your Tomcat service does not contain the setenv.sh configuration file, open the {TOMCAT_HOME}/bin/catalina.sh file and append the preceding configurations to the JAVA_OPTS parameter. For more information, see Row 256 in the catalina.sh file.

    Jetty

    Append the following configurations to the {JETTY_HOME}/start.ini configuration file:

    aliyun-java-agent.jar --exec
    -javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar
    -Darms.licenseKey={LicenseKey}
    -Darms.appName={AppName} 

    Resin

    1. When you start the Resin process, append the following tag to conf/resin.xml or conf/resin.conf:

    <server-default>
        <jvm-arg>-javaagent:{user.workspace}/ArmsAgent/aliyun-java-agent.jar</jvm-arg>
        <jvm-arg>-Darms.licenseKey={LicenseKey}</jvm-arg>
        <jvm-arg>-Darms.appName={AppName}</jvm-arg>
    </server-default> 

    If conf/resin.properties is used, append the following tag to the file:

    jvm_args : -javaagent:{user.workspace}/ArmsAgent/aliyun-java-agent.jar -Darms.licenseKey={LicenseKey} -Darms.appName={AppName}
    1. Append the following tag to the conf/app-default.xml file:

    <library-loader path="{user.workspace}/ArmsAgent/plugin"/> 

    To deploy multiple instances of the same application on a server, set the -Darms.agentId parameter to a logical number to differentiate the JVM processes. Example:

    java -javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar -Darms.licenseKey={LicenseKey} -Darms.appName={AppName} -Darms.agentId=001 -jar demoApp.jar

  7. Restart the Java application.

(Optional) Sample Dockerfile

For a Docker environment, you can refer to the following sample Dockerfile to install an ARMS agent.

# Replace {original-docker-image:tag} with your image address. 
FROM {original-docker-image:tag}
# Replace the working directory based on your business requirements. 
WORKDIR /root/
# Obtain the public endpoint or virtual private cloud (VPC) where you can download the installation package of the ARMS agent in the desired region. For more information, see Step 4 of the "Install an ARMS agent" section. 
RUN wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
# Decompress the installation package of the ARMS agent. 
RUN unzip ArmsAgent.zip -d /root/
# Write the LicenseKey and AppName parameters to environment variables. For more information, see Step 6 of the "Install an ARMS agent" section. 
ENV arms_licenseKey={LicenseKey}
ENV arms_appName={AppName}
# Add the startup script to the JAVA_TOOL_OPTIONS environment variables. 
ENV JAVA_TOOL_OPTIONS ${JAVA_TOOL_OPTIONS} '-javaagent:/root/ArmsAgent/aliyun-java-agent.jar -Darms.licenseKey='${arms_licenseKey}' -Darms.appName='${arms_appName}
### Check the JAVA_TOOL_OPTIONS environment variables. 
RUN env | grep JAVA_TOOL_OPTIONS

### Add custom Dockerfile logic. 
### ......

Verify the result

After about 1 minute, choose Application Monitoring > Application List. If your application is displayed on the Application List page and some data records are sent, your application is monitored by ARMS.