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.
The version of the JDK is supported by Application Monitoring. ARMS supports the following JDK versions:
JDK 1.7.0+
ImportantThe ARMS Application Monitoring agent V3.0.X and later will no longer support Java 7. If you are still using Java 7, we recommend that you upgrade your Java version. For more information, see [Announcement] Application Monitoring no longer supports Java 7.
JDK 1.8.0_25+
NoteIf 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+
JDK 17
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
Log on to the ARMS console. In the left-side navigation pane, choose .
On the Applications page, select a region in the top navigation bar and click Add Application.
In the Integration Center panel, click Java. In the STEP2 section, obtain a 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 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 it, use the VPC address.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
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}/
NoteReplace
registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-springboot-demo:v0.1
with the actual image name.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
NoteReplace
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:
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.