1837990 Members
2994 Online
110124 Solutions
New Discussion

cpu monitoring

 
Ragni Singh
Super Advisor

cpu monitoring

Hey all,

does anyone have a script that monitors cpu utilizing on any process. Any help is greatly appreciated and points will be assigned.
8 REPLIES 8
Stefan Farrelly
Honored Contributor

Re: cpu monitoring

You can use top as it can redirect to a file then grep the PID you want;

rm /tmp/t;top -s 10 -d 1 -f /tmp/t;cat /tmp/t|grep

Change the to the one you want or -s to the length of time in seconds you want the sample for.

Only limitation is top only shows processes which are using a lot of cpu. Glance may be better. Anyone got a similar syntax for glance?
Im from Palmerston North, New Zealand, but somehow ended up in London...
Chuck J
Valued Contributor

Re: cpu monitoring

# glance -G

it will then ask for a process Id which you can enter. You can also run glance in the background if you wish - do a man on glance.

Chuck J
Ken Hubnik_2
Honored Contributor

Re: cpu monitoring

Bring up Glance and look at Process Resources and key in the process number and it will show you the cpu utilization for that process.
Steven Gillard_2
Honored Contributor

Re: cpu monitoring

The simplest way is to use ps as follows:

$ UNIX95= ps -eo "pcpu comm" | grep

This will list the %CPU that the process used during the last scheduling interval. You can add other columns of information, see the ps(1) man page for more information.

Regards,
Steve
MANOJ SRIVASTAVA
Honored Contributor

Re: cpu monitoring

Hi Sanjay


The best way is that , if u have perfview you can just scope the process and define it the the meaurseware agaent and it will record the data whenever the process is run . The system will store readings for all the usages of CPU , RAM , Memory , network and can be plotted .


Manoj Srivastava

justin berkman
Frequent Advisor

Re: cpu monitoring

hi guys
use top as it can redirect to a file then grep the PID you want;

rm /tmp/t;top -s 10 -d 1 -f /tmp/t;cat /tmp/t|grep

Change the to the one you want or -s to the length of time in seconds you want the sample for.

Chuck J
Valued Contributor

Re: cpu monitoring

Jimmy

This is the second time today you have copied someones exact response. Are you trying to get free points or something? If you want points earn them yourself.

Chuck J
Oleg Zieaev_1
Regular Advisor

Re: cpu monitoring

Hello.

If you do not need a statistics file saved aside, you may consider running glance. Once you are in glance type s and specify PID you need to monitor.
You will have all information you need then.
In case you need it in a file, well I would go with top and some scripting around it as recommended by the other professionals.
... and jimmy ;)


Hope this helps.
0leg
Professionals will prevail ...