Operating System - HP-UX
1827066 Members
4202 Online
109713 Solutions
New Discussion

Monitoring for processes consuming excessive CPU - top

 
Grant Spencer
Advisor

Monitoring for processes consuming excessive CPU - top

Hi - does anyone out there know if there is a simple script that I can use to monitor for runaway processes or the like, consuming excessive CPU time? Under linux, top can be run in batch mode, which allows the information to be gathered and subsequently processed - but top under HPUX doesn't appear to have this switch (-d).
If at first you do succeed, try not to look so surprised!
7 REPLIES 7
Niraj Kumar Verma
Trusted Contributor

Re: Monitoring for processes consuming excessive CPU - top

Hi,

top is very much there with -d

# top -d1

or if you have glance plus you can use that.

-Niraj
Niraj.Verma@philips.com
Pete Randall
Outstanding Contributor

Re: Monitoring for processes consuming excessive CPU - top

Grant,

Take a look at Stefan/jimmy's twin answers in this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xaa660fe6d0f7d61190050090279cd0f9,00.html

I think this may be close to what you're looking for.

Pete

Pete
Grant Spencer
Advisor

Re: Monitoring for processes consuming excessive CPU - top

Niraj,

Many thanks for the prompt response - apologies my brain is not in gear just yet - first thing Monday morning...back from 2 weeks holiday etc. etc. !

top -d1 under HPUX includes all the not so nice control characters -

e.g. top -d1 > file.txt

produces completely meaningless babble when you examin it under vi!!
If at first you do succeed, try not to look so surprised!
Ravi_8
Honored Contributor

Re: Monitoring for processes consuming excessive CPU - top

Hi,

top exist in HPUX also (usr/bin/top)

another tool using which you can monitor is the 'glance'
never give up
Niraj Kumar Verma
Trusted Contributor

Re: Monitoring for processes consuming excessive CPU - top

Hey !!

you can use it

# top -d1 |col -b >file.txt


Regards
-Niraj
Niraj.Verma@philips.com
Grant Spencer
Advisor

Re: Monitoring for processes consuming excessive CPU - top

Pete,

Many thanks for you reply - you've answered my question.

Maybe I should have been a little less idle and done some forum searching before I posted the request!!

Thanks guys for all your responses.
If at first you do succeed, try not to look so surprised!
Chris Wilshaw
Honored Contributor

Re: Monitoring for processes consuming excessive CPU - top

You can also use the following

UNIX95= ps -eopid,pcpu,time,vsz,args

This will give you the PID, %cpu, size in KB and command(s) with arguemtns.

you can then process this using awk or sort to suit your needs

eg:

UNIX95= ps -eopid,pcpu,time,vsz,args | awk '{if ($2 >= "10.00") print}'

Should give you the details of all processes which are currently using 10% of the CPU or more.