I’ve already documented the procedure to find out CPU utilization under Linux and UNIX oses using various tools.
However I received a couple of email questions via email:
Howdo I collect Linux system utilization data into a file? How do I email the data or move to another computer?
To be frank you don’t have to do anything data is collected and stored in /var/log/sa location using sa1 and sa2 scripts. It is part of sadc - System activity data collector tools.
The sadc command samples system data a specified number of times ( count ) at a specified interval measured in seconds ( interval ). It writes in binary format to the specified output file.
The sa1 command is a shell procedure variant of the sadc command and handles all of the flags and parameters of that command. The sa1 command collects and store binary data in the /var/log/sa/sadd file, where the dd parameter indicates the current day. The interval and count parameters specify that the record should be written count times at interval seconds.
The sa1 command is designed to be started automatically by the cron command. Type the following command to list files:
# ls /var/log/sa
Output:
sa13 sa14 sa15 sa16 sa17 sa18 sa19 sa20 sa21 sar12 sar13 sar14 sar15 sar16 sar17 sar18 sar19 sar20
How do I copy log files?
You can copy all these logs files using ssh/scp or ftp to another computer. You can run use sar command to read binary raw data files, enter
# sar -f sa13
Output:
Linux 2.6.9-55.ELsmp (monster.labs.nixcraft.in) 05/13/2007 12:00:02 AM CPU %user %nice %system %iowait %idle 12:10:01 AM all 19.75 0.00 2.29 7.49 70.48 12:20:01 AM all 2.28 0.00 0.27 0.06 97.39 12:30:01 AM all 2.58 0.00 0.32 0.07 97.02 12:40:02 AM all 16.05 0.00 3.12 13.48 67.36 12:50:01 AM all 10.78 0.00 1.20 3.61 84.41 01:00:01 AM all 2.42 0.00 0.29 0.30 96.99 01:10:01 AM all 3.70 0.00 0.42 0.42 95.47 01:20:01 AM all 2.47 0.00 0.28 0.14 97.11 01:30:01 AM all 3.20 0.00 0.31 0.15 96.34 01:40:01 AM all 2.46 0.00 0.27 0.07 97.20 01:50:01 AM all 2.40 0.00 0.26 0.10 97.24 .... .....
See also:
- How do I find out Linux CPU utilization?
- Read man pages of sa1, sa2, sar and sadc for more information.
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- 10 Greatest Open Source Software Of 2009
- My 10 UNIX Command Line Mistakes
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email this to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: May/21/2007



{ 0 comments… add one now }