To monitor a Liberty profile inside a Docker container, you must use the docker
run command with a few options to configure the data collector before the WebSphere® Application Server Liberty can be started.
Before you begin
You must install the WebSphere Applications agent on
the Docker host.
About this task
Each Liberty profile running inside a Docker container requires a data collector to collect
resource metrics, transaction metrics, and diagnostics data, and then transmit the data to the
monitoring agent that is running on the Docker host. All data collectors that are configured on the
same Docker host share the same monitoring agent on the host.
Procedure
To configure the data collector for a Liberty profile container, complete the following
steps:
-
Create a .txt silent response file, specify the following configuration
options in the file and save it.
tema.host=agent_host
was.appserver.server.name=liberty_profile_name
where tema.host is used to specify the IP address of the monitoring agent
host; was.appserver.server.name is used to specify the name of the Liberty
profile.
Tip: A sample silent response file
(sample_silent_liberty_config.txt) is provided in the
<agent_install_dir>/agent/yndchome/7.3.0.14.08/bin directory. You can create
your own response file based on this sample file.
-
Run the following command to launch the new Docker container. Note that you must accept the
license to complete the configuration by setting the LICENSE parameter to
accept.
$docker run -d -e LICENSE=accept \
-e JAVA_HOME=<java_home_dir> \
-p <port_number>:<port_number> \
-v <web_app_dir>:<liberty_install_dir>/usr/servers/<liberty_profile_name> \
-v <agent_install_dir>/agent/yndchome:<agent_install_dir>/agent/yndchome websphere-liberty /bin/bash \
-c "<agent_install_dir>/agent/yndchome/<dcversion>/bin/config.sh -silent <absolute_path_to_silent_response_file> && <liberty_install_dir>/bin/server run <liberty_profile_name>"
where:
- <java_home_dir> is the directory of the JRE that is used by the Liberty
profile. For example, /opt/ibm/java/jre.
- <port_number> is the port number that is used for communication between
the container and the host.
- <web_app_dir> is the directory where the web application locates.
- <liberty_install_dir> is the installation directory of the WebSphere Application Server Liberty. Default is
/opt/ibm/wlp.
- <liberty_profile_name> is the name of the Liberty profile.
- <agent_install_dir> is the installation directory of the WebSphere Applications agent. Default is
/opt/ibm/apm.
- <dcversion> is the version number of the data collector for WebSphere Applications agent. For example, 7.3.0.14.08.
- <absolute_path_to_silent_response_file> is the absolute path to the
silent response file that you created.
For example, the following command configures the data collector for the Liberty profile
named newitcam. Both the
WebSphere Applications agent and the
Liberty profile are installed in the default directories. The version of the monitoring agent and
data collector is
7.3.0.14.08.
$docker run -d -e LICENSE=accept \
-e JAVA_HOME=/opt/ibm/java/jre \
-p 9082:9082 \
-v /home/kub/liberty-docker/newitcam:/opt/ibm/wlp/usr/servers/newitcam \
-v /opt/ibm/apm/agent/yndchome:/opt/ibm/apm/agent/yndchome websphere-liberty /bin/bash \
-c "/opt/ibm/apm/agent/yndchome/7.3.0.14.08/bin/config.sh -silent /opt/ibm/wlp/usr/servers/newitcam/silent_config.txt && /opt/ibm/wlp/bin/server run newitcam"
Results
Now you can verify that the WebSphere Applications agent data is displayed in the Cloud APM console. The
Cell name column on the WAS Information widget shows
the ID of the Docker container where the Liberty profile is running.
What to do next
To unconfigure the data collector interactively, use the following command to start the
unconfiguration
utility:docker exec -i container_id "<agent_install_dir>/yndchome/7.3.0.14.08/bin/unconfig.sh"