The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cpu Usage mirusnet UNIX for Advanced & Expert Users 0 04-10-2008 12:49 PM
CPU usage and memory usage mansoorulhaq High Level Programming 1 08-09-2007 01:55 PM
cpu usage gfhgfnhhn UNIX for Dummies Questions & Answers 4 09-17-2006 06:11 AM
Monitor CPU usage and Memory Usage Gajanad Bihani High Level Programming 2 03-09-2005 04:35 AM
cpu usage sushaga Filesystems, Disks and Memory 0 04-06-2002 05:46 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-30-2006
WG1 WG1 is offline
Registered User
 

Join Date: Apr 2006
Posts: 2
Getting CPU Usage

For analysis, I need to gather CPU usage from say 1:00 PM to 2:00 PM every 10 seconds on a given day. I heard this can be done with awk, but my UNIX is kind of rusty.
Reply With Quote
Forum Sponsor
  #2  
Old 04-30-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Try running this command at 1:00 PM.
Code:
mpstat 10 60 >> /path/to/logfile &
Reply With Quote
  #3  
Old 04-30-2006
Registered User
 

Join Date: Aug 2001
Posts: 179
sar -u 10 60
Reply With Quote
  #4  
Old 04-30-2006
Registered User
 

Join Date: Jan 2006
Posts: 23
Hello,

In a Linux box you can get {1,5,15} mins CPU load averages from /proc/loadavg special "file" with the help of "awk", for example:

Quote:
$ DATE=`date +"%Y-%m-%d %H:%M:%S"` cat /proc/loadavg | awk ' { print ENVIRON["DATE"] " - " $1 "/" $2 "/" $3 }'
2006-05-01 00:45:39 - 0.33/0.26/0.24
You can add this simple one-liner to a cronjob and redirect the output to a log file...

--
Santi Saez
Reply With Quote
  #5  
Old 05-01-2006
WG1 WG1 is offline
Registered User
 

Join Date: Apr 2006
Posts: 2
Thanks everyone!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0