IBM Performance Management

Monitoring a queue manager in a Docker container

To monitor a queue manager that is running inside a Docker container, use the agent provided docker file and scripts to build or update the IBM® MQ Advanced for Developers Docker container image.

Before you begin

  • Install the WebSphere® MQ agent on your Docker host.
    Important: You can choose not to install the agent directly on your Docker host. If you do not want to use the WebSphere MQ agent directly on your Docker host, you must bypass the prerequisite scanner before you install the agent. To do this, enter the following command on the target host before you run the agent installation scripts:
    export SKIP_PRECHECK=1
  • Download the docker file from the GitHub website (https://github.com/dongcc/apmmq-docker/).

Procedure

Changing an existing image

Procedure

  1. Use the patch.sh shell script to copy the scripts into your existing container with the following command:
    ./patch.sh ${container_ID}
    where container_ID is the ID of your Docker container.
    Note: You can get your container ID with the docker ps Docker command.
  2. Update and commit your image with the following command, where mqadvanced is the name of the IBM MQ Advanced for Developers Docker image that exists in your repository:
    docker commit -m "enable APM monitoring" 
    -a "DCC" ${container_ID} ibmimages/mqadvanced:v2
    A new image is created in your repository named ibmimages/mqadvanced:v2.
  3. Run the image with the following command:
    docker run \
      --env LICENSE=accept \
      --env MQ_QMGR_NAME=<queue_manager_name> \
      --volume <mq_file_system>:var/mqm \
      --volume <install_dir>:/opt/ibm/apm/agent \
      --entrypoint=mqwithapm \
      --publish-all \
      --detach \
      ibmimages/mqadvanced:v2
    where:
    • LICENSE=accept indicates that you accept the terms of the IBM MQ for Developers license. To view the license terms, set it to view. If you do not set the variable, the container ends with a usage statement. You can view the license in a different language by setting the LANG environment variable.
    • <queue_manager_name> is the name of the queue manager that runs in the Docker container.
    • <mq_file_system> is the directory of the IBM MQ file system on your Docker host. The default is /var/mqm on Linux systems.
    • /var/mqm is the data directory of your Docker container. Do not change this value.
    • <install_dir> is the directory where you installed IBM Performance Management on your Docker host. The default is /opt/ibm/apm/agent on Linux systems.
    • /opt/ibm/apm/agent is the home directory of IBM Performance Management in your Docker container. Do not change this value.
    • entrypoint=mqwithapm overrides the existing the ENTRYPOINT of the IBM MQ Docker container. Note this script also includes the steps to call the ENTRYPOINT of the IBM MQ container.
    • ibmimages/mqadvanced:v2 is the image that you committed in the previous step.
    Tip: If you have multiple containers, you can share Performance Management installation on the Docker host.
    In this step, you do the following things:
    • Accept the license by setting the LICENSE value to accept.
    • Specify a queue manager name by using the MQ_QMGR_NAME environment variable. For more information, see ibm-messaging GitHub (http://github.com/ibm-messaging/mq-docker).
    • Mount your IBM MQ data path and the monitoring agent home directory on the Docker host into the Docker container.

Building the Docker image

Procedure

  1. Build the Docker image from the provided docker file. For example, an image named ibmcom/apm4mq can be created in your local Docker registry with the following command:
    docker build -t ibmcom/apm4mq

    This image includes a full installation of IBM MQ Advanced for Developers and the WebSphere MQ agent.

  2. Run the image with the following command:
    docker run \
      --env LICENSE=accept \
      --env MQ_QMGR_NAME=<queue_manager_name> \
      --volume <mq_file_system>:var/mqm \
      --volume <install_dir>:/opt/ibm/apm/agent \
      --publish-all \
      --detach \
      ibmcom/apm4mq
    • LICENSE=accept indicates that you accept the terms of the IBM MQ for Developers license. To view the license terms, set it to view. If you do not set the variable, the container ends with a usage statement. You can view the license in a different language by setting the LANG environment variable.
    • <queue_manager_name> is the name of the queue manager that runs in the Docker container.
    • <mq_file_system> is the directory of the IBM MQ file system on your Docker host. The default is /var/mqm on Linux systems.
    • /var/mqm is the data directory of your Docker container. Do not change this value.
    • <install_dir> is the directory where you installed IBM Performance Management on your Docker host. The default is /opt/ibm/apm/agent on Linux systems.
    • /opt/ibm/apm/agent is the home directory of IBM Performance Management in your Docker container. Do not change this value.
    • entrypoint=mqwithapm overrides the existing the ENTRYPOINT of the IBM MQ Docker container. Note this script also includes the steps to call the ENTRYPOINT of the IBM MQ container.
    • ibmcom/apm4mq is the image that you committed in previous step.
    In this step, you do the following things:
    • Accept the license by setting the LICENSE value to accept.
    • Specify a queue manager name by using the MQ_QMGR_NAME environment variable. For more information, see ibm-messaging GitHub (http://github.com/ibm-messaging/mq-docker).
    • Mount your IBM MQ data path and the monitoring agent home directory on the Docker host into the Docker container.

Running administrative commands

About this task

It is recommended that you configure the queue manager in your own custom image. However, you might need to run IBM MQ commands directly inside the process space of the Docker container.

Procedure

To run a command against a running queue manager, run the docker exec command non-interactively under Bash.

The following command is an example of running the IBM MQ command under Bash:

docker exec \
  --tty \
  --interactive \
  ${container_ID} \
  bash -c dspmq

By using this method, you have full control over all aspects of the Performance Management installation and IBM MQ installation.

Remember: If you use this method to make changes to the IBM MQ file system, the changes are lost when you re-create your container. To avoid this, make your changes in volumes.

Verifying your container is running correctly

Procedure

To verify whether the image is used as provided or is customized, complete the following steps:

  1. Run a container. Make sure to expose the port 1414 to the host for the container to start without errors.
  2. Run the following command to show the status of your node. If the node is listed as running, the container is running correctly.
    docker exec \
      ${container_ID} \
      bash -c "/opt/ibm/apm/agent/bin/mq-agent.sh status"

Results

Now, you can access the Performance Management console to view the WebSphere MQ agent data. For instructions, see Starting the Performance Management console.