Link to home
Start Free TrialLog in
Avatar of MichaelBalack
MichaelBalackFlag for Singapore

asked on

how to see the memory spikes and by which process any time in Solaris linux?

This is using a Solaris 11.  We have a monitoring server that shows that this Solaris server is have a few spikes on the memory performance for 4 consecutive weeks. This may not seems to be a big problem, however, my management need to have a clearer picture on this.

In view of this, my senior wants to implement a process monitoring to see differences in processes (daytime,user,pid,ppid,vsz,rss,pcpu,command) in /var/adm/perf which is running every 5 Minutes. The main objective is so as we can see which process causing the memory spikes at any time. I am not a shell script expert. Please suggest how to write a script that can accomplish the above task.

Thanks in advance.
Avatar of arnold
arnold
Flag of United States of America image

It is easier to answer the question when you list which services the system provides,
Database, web server,, mail server, etc.

top -n 1

prstat
As I recall, from using Solaris years ago, the sar system is available.

If this is true for your Solaris version, likely this will be the simple way to look at snapshots across time.
@MichaelBalack

>> As per comment from Arnold (using top):

I do not have SunOS here,
Written following command at Linux:
$ /usr/bin/top -n 1 | sed -e "s/^[//g;s/\[H\[2J(B\[m//g;s/(B\[m//g;s/\[39\;//g;s/49m//g;s/\[6\;1H\[K\[36\;1H\[//g;s/\?12l\[//g;s/\?25h//g;s/\[6\;1H//g;s/\[7m//g;s/\[K//g;"

Open in new window

You can redirect to other file
commands > $(/usr/bin/date "+%d_%m_%Y_%H_%M_%S_%Z.txt")

Use related full path to date/top/...
If you know the process id, use
/usr/bin/ps -lp RequiredPID
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.