Memory information collection script extended with "top" ouput and "ps" output sorted by RSS memory utilization
Last Updated March 22, 2018
This script collects the data collected by original cbs_meminfo and adds ps output sorted by RSS, and top output.
Sometimes it might also be useful to collect user space processes memory allocation or CPU utilization data which the original cbs_meminfo does not provide.
If a system (CPMs or APMs) experiences repeated out of memory conditions or high CPU, you can use the script below, also attached to this article, to help investigate the factors that may contribute to the issue. The script will collect memory information from /proc/meminfo and/proc/slabinfo, ps and top output on a continuous 5-minute interval. The 5-minute interval is defined at the end of the script by the sleep time in seconds sleep (300);.
Note: -If the memory or high CPU issue is sporadic and last less than 5 minutes, you will have to change the 'sleep time' accordingly. For example, if the issue disappear after 30 seconds you might want to change the sleep time to 20 or 15 seconds. The idea is to take the data while the issue is happening. -The script will GZ the file automatically when it reaches 50M to avoid disk utilization issues.