Use the following procedure to configure Zowe Java-based servers so that they can be monitored by IBM Z OMEGAMON AI for JVM.
About this task
This approach requires a one-time modification of the component startup script to include -Xoptionsfile. After that, you can enable or disable monitoring by creating or removing thejvm.options file without further script changes.
The examples in this procedure use the Zowe Gateway component. The same approach can be used for other Zowe Java components.
Procedure
-
Find the startup script by using the following Unix command:
find zowe/components -name start.sh
This will list scripts for the components. For the Zowe Gateway component, the startup script is typically the following:
zowe/components/gateway/bin/start.sh
-
Define a directory for JVM options and logs. For example:
/u/tmp/zowec
Make sure the directory exists, and the user that starts Zowe has write permission.
-
In the Zowe component startup script (
zowe/components/gateway/bin/start.sh), in the beginning of the script, add the following:
JVM_OPTIONS_DIR="/u/tmp/zowec"
COMPONENT_ID="GW"
JVM_OPTIONS_FILE="${JVM_OPTIONS_DIR}/jvm.options.${COMPONENT_ID}"
if [ -f "${JVM_OPTIONS_FILE}" ]; then
exec 1>>"${JVM_OPTIONS_DIR}/start.log1${COMPONENT_ID}" \
2>>"${JVM_OPTIONS_DIR}/start.log2${COMPONENT_ID}"
JVM_OPTIONS_ARGS="-Xoptionsfile=${JVM_OPTIONS_FILE} -XshowSettings"
else
JVM_OPTIONS_ARGS=""
fi
where:
- JVM_OPTIONS_DIR: Directory that contains JVM options files and startup logs.
- COMPONENT_ID: Identifier for the Zowe component (for example, GW for Gateway).
- JVM_OPTIONS_FILE: Component-specific JVM options file.
- JVM_OPTIONS_ARGS: Shell variable that expands to JVM startup arguments when the options file exists.
-
Locate the Java execution command in the startup script and add the JVM_OPTIONS_ARGS variable:
java \
-Dloader.path=${GATEWAY_LOADER_PATH} \
${JVM_OPTIONS_ARGS} \
-jar ${JAR_FILE} &
-
Create the jvm.options file to enable monitoring:
touch /u/tmp/zowec/jvm.options.GW
-
In the jvm.options file, add the enablement statements:
-agentpath:/rte_uss_dir/rtehome/kan/bin/IBM/libkjjagent_64.so
-javaagent:/rte_uss_dir/rtehome/kan/bin/IBM/kjj.jar
-Xbootclasspath/a:/rte_uss_dir/rte_name/kan/bin/IBM/kjjboot.jar
Important: Do not define Java options by using the OPENJ9_JAVA_OPTIONS environment variable because doing so disables JZOS, which is required by the OMEGAMON Java agent.
What to do next
After any Zowe upgrade, revalidate that the startup script still contains these changes, as upgrades may overwrite custom edits.