How can I collect average CPU utilization percent?

E

ewaguespack

I am writing a script that monitors various system health metrics, and
I am done except for 1 thing... average CPU utilization.

OS:Linux (RHEL3)
Shell:Bash

Do any of you know a command I could run that would return the average
CPU utilization in the last 5 minutes averaged across all CPUs?

I have looked at /proc/loadavg, /proc/stat, loadavg, and top so far
without finding a way to do this.


Thanks in advance.
 
D

DJ Stunks

Jim said:
top

See 'man top' for details. Look for 'non-interactive' execution and
setting the delay interval and the number of samples. You will have to
run it for 5 minutes to get the utilization for the past 5 minutes,
however.

The uptime command will give you the load averages for the past 1, 5,
and 15 minutes immediately. While not CPU utilization, but process
queue, the load average is an important statistic for measuring the
load on your system.

did I get off on the wrong floor again?

-jp
 
J

John L

I am writing a script that monitors various system health metrics, and
I am done except for 1 thing... average CPU utilization.

OS:Linux (RHEL3)
Shell:Bash

Do any of you know a command I could run that would return the average
CPU utilization in the last 5 minutes averaged across all CPUs?

You may be getting close to rewriting sar.
Note that you need to run a couple of shellscripts
via cron in order to use historical information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top