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
- ARMS is activated. For more information, see Activate and upgrade ARMS.
- A Java application is deployed in a Docker cluster.
-
If the JDK Version is 1.8.0_25 or 1.8.0_31, you may fail to install the arms Agent. In this case, upgrade the JDK version to the latest version, which is 1.8.X.
Background information
Step 1: Obtain the license key
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 link for downloading 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 link for downloading the ARMS agent based on your region.
Note Use the public endpoint. If the download fails, use the VPC endpoint.
Region Download link for the Internet Download link for 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 (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.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
Verify the result
After about 1 minute, if your application is displayed in the application list 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:
- Delete the configurations that you added to the Dockerfile file in Step 2: Integrate an existing image.
- Run the
docker build
command to build an image. - Run the
docker run
command to start the image.