Operating System - HP-UX
1748111 Members
3641 Online
108758 Solutions
New Discussion юеВ

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

 
SOLVED
Go to solution
senthil_kumar_1
Super Advisor

CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Hi All,

We are uning Linux (Redhat and Suse) and HPUX (11.00 and 11.11).

Adventnet's monitoring tool "opsmanager" is being used to monitor the Linux and HPUX servers.

Actually we are getting lot of alert messages for more CPU and Memory utilization in almost all servers.

But we can find idle CPU - 90% thru "top" command manually.

Is there any command to find the total CPU utilization and Memory utilization for eahc platform Linux and HPUX?

How to find the Top 3 CPU and Memory Utilized process?

24 REPLIES 24
Ganesan R
Honored Contributor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Hi,

>>Is there any command to find the total CPU utilization and Memory utilization for eahc platform Linux and HPUX?<<

many. top, sar, vmstat, glance, etc..

>>How to find the Top 3 CPU and Memory Utilized process?<<

ofcourse top command will provide the top resource consuming process. Glance is more sphosticated tool.
Best wishes,

Ganesh.
James R. Ferguson
Acclaimed Contributor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Hi:

> How to find the Top 3 CPU and Memory Utilized process?

Instantly in a single interval or over some period of time?

One of the best tools for performance monitoring in HP-UX is 'glance'. If you don't have it, you should. A 30-day trial version can be obtained from the Application CDRoM.

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Shalom,

I would use this for memory processes:

http://www.hpux.ws/?p=8

I would then re-write it to get the top three cpu processes, which is pretty easy.

You say:
>>
Adventnet's monitoring tool "opsmanager" is being used to monitor the Linux and HPUX servers.
<<

My response is I can do it just as well with a shell script for less money.

Why are we mentioning this tool? I'm confused.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
senthil_kumar_1
Super Advisor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Hi All,


1) I need detailed notes for understanding the outputs of top, sar, vmstat, glance.


Hi Steven,

Do you have any sample script for total cpu, memory utilization and top 3 or 10 process based on memory and cpu utilization?.

Steven E. Protter
Exalted Contributor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Shalom,

You say, my comments inline:
1) I need detailed notes for understanding the outputs of top, sar, vmstat, glance.

top:
http://www.webmasterworld.com/forum40/1205.htm

http://www.teamquest.com/resources/gunther/display/5/

http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2006-08/msg00172.html

http://www.cyberciti.biz/tips/understanding-linux-and-unix-load-average.html

sar is more of an rtfm issue:
http://www.unix.com/hp-ux/42198-sar-output-gives-98-idle-cpu.html

http://www-d0.fnal.gov/computing/archive/unix_sys_diag.html

http://groups.google.com/group/comp.unix.solaris/browse_thread/thread/c9b7c62cc92c5fb8?pli=1

vmstat:
http://www.unix.com/unix-advanced-expert-users/30984-output-vmstat.html

http://www.remote-dba.net/t_tuning_vmstat_utility.htm

http://www.adminschoice.com/docs/iostat_vmstat_netstat.htm

I will skip glance because the man pages are written by HP and are excellent.


Hi Steven,

Do you have any sample script for total cpu, memory utilization and top 3 or 10 process based on memory and cpu utilization?.

This utility accepts command line input. If you tell it 3 or 10 as the first command line parameter that is how many processes it will monitor. It shows the top processes in terms of memory use.
http://www.hpux.ws/?p=8

As I said earlier, I am looking at writing one that does this based on top CPU users.

I'm looking at the code and seeing how easy or hard this is going to be to get done.

SEO
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

I'm not looking for any points here.

Here is the heart of the HP-UX code in the leak detector:

if [ -z "$FILTER" ]
then
CL="ps -ef -o pid,sz,vsz,args | sort -nr -k 2,3| head -$NUM"
else
CL="ps -a -o pid,sz,vsz,args -C $FILTER | sort -nr -k 2,3| head -$NUM"
fi
;;

It merely does a reverse sort largest to smallest on fields two and three.

To modify it to get the top CPU users, I would think we would need to add the right ps fields and sort by them.

It looks simple. I'm suddenly interested in this.

I would set up a new command line argument for the utility to permit a switch to determine the output.

The parameter we would want to use is pcpu

So I would say quick and dirty you can simply modify this utility to get you top cpu users.

I'm looking at posting an update that will make my handy dandy memory leak detector able to do what you wish it to do.

I'm actually starting up my HP-UX system in anticipation of testing this.

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Shalom again,

this part works:

ps -ef -o pid,sz,vsz,args,pcpu | sort -nr -k 5| head -n 3

The head statement gets you the top 3 after a sort

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
senthil_kumar_1
Super Advisor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Hi Steven,

I am using HPUX 10.20, 11.00 and 11.11.

that command is throwing error message.

Ex:

root@lgsna:/root > ps -ef -o pid,sz,vsz,args,pcpu | sort -nr -k 5| head -n 3
ps: illegal option -- o
usage: ps [-edaxzflP] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R prmgroup] [-Z psetidlist]




Sivakumar MJ._1
Respected Contributor

Re: CPU Utilization, Memory Utilization and TOP 3 CPU and Memory Utilized process.

Senthil,

This link will help u ..

http://research.att.com/~gsf/man/man1/ps.html