Docker
Applying the agent
Based on an existing Docker image, build an image with the WhaTap agent settings added.
This document covers only the installation of the Java agent. To apply with WhaTap Kubernetes monitoring, see the following.
-
Create a Docker build directory.
mkdir -p {Docker build dir}
-
Create the whatap.conf file.
cat >{Docker build Dir}/whatap.conf <<EOL
#Enter the access key.
license=XXXXXXXXXXXXXX-XXXXXXXXXXXXXX-XXXXXXXXXXXXXX
#Enter the collection server IP.
whatap.server.host=xx.xx.xx.xx/yy.yy.yy.yy
EOL -
Create a Dockerfile.
In case of building an image, you can copy the jar file to apply in the
-javaagent
option from the WhaTap image.cat >/home/silver/whatap/docker/Dockerfile <<EOL
FROM whatap/kube_mon as build
## Create an actual image (Add the WhaTap image)
## $Image_Name (image name)
FROM $Image_Name
RUN mkdir -p /whatap
COPY /data/agent/micro/whatap.agent-*.jar /whatap
COPY ./whatap.conf /whatap/
#...
EOL -
In
JAVA_OPT
, add the following content.WHATAP_HOME=/whatap
WHATAP_JAR=ls ${WHATAP_HOME}/whatap.agent-*.jar | sort -V | tail -1
export JAVA_OPTS="-javaagent:${WHATAP_JAR} " -
Build the Docker.
cd docker
docker build -t $Image_Name
In case of Java 17 or later, add the following options for reflection.
--add-opens=java.base/java.lang=ALL-UNNAMED
You can modify the Java agent file name by using the Rename
function. Once the Java agent name has been modified, enter a new name in JAVA_OPTS
.
Example of how to modify the Java agent name
java -cp whatap.agent-X.Y.Z.jar whatap.agent.setup.Rename -from whatap.agent-X.Y.Z.jar -to whatap.agent.jar
Viewing the heap histogram
WhaTap's Java Monitoring provides the function to view the status of heap occupancy objects in the JVM memory (sizes for each object in heap memory). In APP > Instance performance analysis, select the Heap histogram tab.
Java versions 6 to 8 support basic functions without the JVM options. However, for some Java versions, the JVM options must be applied as follows:
-
Java 9 to Java 15
-Djdk.attach.allowAttachSelf=true
examplejava -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -Djdk.attach.allowAttachSelf=true -jar {application.jar}
-
Java 16 or later
-Djdk.attach.allowAttachSelf=true
--add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMEDexamplejava -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -Djdk.attach.allowAttachSelf=true --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED -jar {application.jar}
It does not support Java 5 or earlier and IBM Java.
Starting the monitoring
Once the application server is restarted after configuring all settings, the agents start collecting data. See the following.