App Connect

App Connect

Join this online user group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#Applicationintegration
#App Connect
#AppConnect
 View Only

Running a memory monitoring script for an Integration Server process running in a container under App Connect Operator

By AMAR SHAH posted Thu November 30, 2023 05:35 AM

  

While investigating memory leak related issues, it is often required to capture the memory usage of the running Integration Server over a period of time.  In an on-prem VM deployment of App Connect, you may typically run a shell script like below to log the memory usage using commands like ‘ps’ and ‘top’  , at regular intervals.

#!/bin/bash

echo "Starting memory  monitoring script"

while true

do

        date>> /tmp/memcheck.txt

        ps -elf  >> /tmp/memcheck.txt

        echo "------------------" >> /tmp/memcheck.txt

        top -b -c -n 1 >> /tmp/memcheck.txt

        sleep 30

        echo "***************************** " >> /tmp/memcheck.txt

done

When running App Connect in a k8s environment like CP4I using the App Connect Operator,  you can follow the procedure below to setup and run the memory monitoring script.

  • Create the script file (.sh) using the code similar to as shown above

  • Zip it into an archive file.  We will be passing this script to the container using Generic File configuration.

  • You can invoke the script during Integration Server startup by configuring the server.conf.yaml.   The files passed via Generic Files get unpacked under /home/aceuser/generic folder inside the container.  Therefore, we use this path while configuring the StartupScript stanza in server.conf.yaml

StartupScripts:

  FirstScript:

    command: 'chmod +x /home/aceuser/generic/*.sh'

    directErrorToCommandOutput: false

    includeCommandOutputInLogs: true

    stopServerOnError: false

  SecondScript:

    command: nohup /home/aceuser/generic/memcheck.sh > /tmp/nohup.txt 2>&1 &

    directErrorToCommandOutput: false

    includeCommandOutputInLogs: true

    stopServerOnError: false

Note that, since we want to keep the script running in background  and get the control back to the IS console,  please use the syntax exactly as shown in the example below

command: nohup /home/aceuser/generic/memcheck.sh > /tmp/nohup.txt 2>&1 &

When you deploy the Integration Server with these configurations (Generic Files and server.conf.yaml),  You can verify that these configurations have taken effect by observing the pod log. You will observe the BIP messages as shown below:

BIP1990I: Integration server 'memcheck' starting initialization; version '12.0.8.0' (64-bit)

BIP9560I: Script 'FirstScript' is about to run using command 'chmod +x /home/aceuser/generic/*.sh'.

BIP9565I: Script 'FirstScript' has run successfully.

BIP9560I: Script 'SecondScript' is about to run using command 'nohup /home/aceuser/generic/memcheck.sh > /tmp/nohup.txt 2>&1 &'.

BIP9565I: Script 'SecondScript' has run successfully.

In the above example, the script is coded to write the output to location /tmp/memcheck.txt. You can verify that the output is being written correctly by viewing the contents of the file

Log into the container and navigate to /tmp/

# cat  memcheck.txt

 

When requested by IBM support,  copy this file out of the container and upload it to support case.

 

0 comments
24 views

Permalink