IBM Support

Mustgather: How to monitor Process Sizes on Linux

Troubleshooting


Problem

It is often useful to be able to monitor the size of the processes running on a machine, particularily in the cases of 100% CPU usage and/or performance problems.

Resolving The Problem

Monitoring the size of processes on Linux can be achieved using the ps utility, as carried out with the following command:

    ./ps.sh ps.log

which uses the following script:



#log file name
PS_LOG=$1
# There are 288- 5 minute intervals in a day
LIMIT=288
#sleep for 5 miniutes
SLEEP_TIME=300
while true
do
i=0
echo >$PS_LOG
while [ $i -le "$LIMIT" ];
do
date >> $PS_LOG;
ps avwwwg >> $PS_LOG;
i=`expr $i + 1`;
sleep $SLEEP_TIME;
done
done

where:

LIMIT          is the number of log cycles before the
               log file rolls over
SLEEP_TIME     is the amount of time before each log

               cycle

[{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Debugging Tools","Platform":[{"code":"PF016","label":"Linux"}],"Version":"5.0","Edition":"J2SE","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21222441