After you install the Application Real-Time Monitoring Service (ARMS) agent for a Java application that is deployed in a Docker cluster, ARMS starts to monitor the Java application. ARMS automatically adapts to the environment where the application runs. You do not need to set up the runtime environment for Tomcat, Jetty, or Spring Boot applications. This topic describes how to install the ARMS agent for a Java application that is deployed in a Docker cluster.

Prerequisites

  • A Java application is deployed in a Docker cluster.
  • Check the version of the Java Development Kit (JDK). ARMS supports the following JDK versions:
    • JDK 1.7.0+
    • JDK 1.8.0_25+
      Note
      • If you deploy applications in Kubernetes clusters, we recommend that you use JDK V1.8.0_191 or later.
      • Make sure that the JDK version is not 1.8.0_25 or 1.8.0_31. Otherwise, the ARMS agent may fail to be installed. In this case, we recommend that you upgrade JDK to the latest 1.8.X.
    • JDK 11.0.8+
    Note JDK versions 1.8 and later have different probe installation packages than JDK versions 11. Download the corresponding probe installation packages or adjust the configurations of application monitoring component ack-onepilot based on different JDK versions.

Background information

ARMS Application Monitoring allows you to monitor Java applications by using the {original-docker-image:tag} image. To do so, edit the Dockerfile file to integrate an existing image. Then, build and start a new image.

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: Integrate an existing image

Edit the Dockerfile file, as shown in the following example.

###################################
##                              ###
##      ARMS APM DEMO Docker    ###
##          For Java            ###
##      withAgent   V0.1        ###
##                              ###
###################################
# Replace {original-docker-image:tag} with your image address. 
FROM {original-docker-image:tag}
WORKDIR /root/
# Replace the URL with the actual download URL of the ARMS agent based on your region. 
RUN wget "http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
RUN unzip ArmsAgent.zip -d /root/
# Obtain the license key, as shown in Step 1. 
# {AppName} is the name of the application that is monitored by ARMS. The application name cannot contain Chinese characters. 
# If all images are connected to the same application monitoring job, you need to specify only the arms_licenseKey and arms_appName parameters. 
ENV arms_licenseKey={LicenseKey}
ENV arms_appName={AppName}
ENV JAVA_TOOL_OPTIONS ${JAVA_TOOL_OPTIONS} '-javaagent:/root/ArmsAgent/arms-bootstrap-1.7.0-SNAPSHOT.jar -Darms.licenseKey='${arms_licenseKey}' -Darms.appName='${arms_appName}
### for check the args
RUN env | grep JAVA_TOOL_OPTIONS
### Add custom Dockerfile logic. 
### ......

Replace the example values in the preceding configuration file based on the following instructions.

  • Replace {original-docker-image:tag} with your image address. If you do not have a custom image, use a system image instead.
  • Replace the URL with the actual download URL of the ARMS agent based on your region.
    Note Use a public endpoint. If you cannot download, use the VPC address.
    The following table lists the download URLs of the agent installation package (JDK version 8 or earlier) for different regions.
    Region Download URL over the Internet Download URL over a 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
    Australia (Sydney)
    wget "http://arms-apm-ap-southeast-2.oss-ap-southeast-2.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
    wget "http://arms-apm-ap-southeast-2.oss-ap-southeast-2-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
    India (Mumbai)
    wget "http://arms-apm-ap-south-1.oss-ap-south-1.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
    wget "http://arms-apm-ap-south-1.oss-ap-south-1-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
    China East 1 Finance N/A
    wget "http://arms-apm-cn-hangzhou-finance.oss-cn-hzjbp-b-internal.aliyuncs.com/ArmsAgent.zip" -O ArmsAgent.zip
    China East 2 Finance N/A
    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 N/A
    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
  • Replace {LicenseKey} with your license key. Replace {AppName} with the name of your application. The application name cannot contain Chinese characters.

Step 3: Build and start a new image

  1. Run the docker build command to build an image.
    docker build -t registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-springboot-demo:v0.1 -f /{workspace}/Dockerfile /{workspace}/
    Note Replace registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-springboot-demo:v0.1 with the actual image name.
  2. Run the docker run command to start the image.
    docker run -d -p 8081:8080 registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-springboot-demo:v0.1
    Note Replace registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-springboot-demo:v0.1 with the actual image name.

Verify the result

After about 1 minute, if your application is displayed on the Applications page and some data records are sent, it indicates that your application is monitored by ARMS.

Uninstall the ARMS agent

If you no longer need to monitor the Java application in the Docker cluster, perform the following steps to uninstall the ARMS agent:

  1. Delete the configurations that you added to the Dockerfile file in Step 2: Integrate an existing image.
  2. Run the docker build command to build an image.
  3. Run the docker run command to start the image.