Rediscovering sar

By  

If you want to focus on one particular CPU, substitute the CPU number for the word ALL (e.g., sar -P 2 10 1).

# sar -P ALL 10 1
Linux 2.6.18-128.el5 (boson)     07/22/2012

04:56:06 PM       CPU     %user     %nice   %system   %iowait    %steal     %idle
04:56:16 PM       all      0.04      0.00      0.03      0.01      0.00     99.92
04:56:16 PM         0      0.00      0.00      0.00      0.00      0.00    100.00
04:56:16 PM         1      0.10      0.00      0.00      0.00      0.00     99.90
04:56:16 PM         2      0.10      0.00      0.10      0.10      0.00     99.70
04:56:16 PM         3      0.00      0.00      0.00      0.00      0.00    100.00
04:56:16 PM         4      0.00      0.00      0.10      0.00      0.00     99.90
04:56:16 PM         5      0.10      0.00      0.10      0.00      0.00     99.80
04:56:16 PM         6      0.10      0.00      0.00      0.00      0.00     99.90
04:56:16 PM         7      0.10      0.00      0.00      0.00      0.00     99.90


Average:          CPU     %user     %nice   %system   %iowait    %steal     %idle
Average:          all      0.04      0.00      0.03      0.01      0.00     99.92
Average:            0      0.00      0.00      0.00      0.00      0.00    100.00
Average:            1      0.10      0.00      0.00      0.00      0.00     99.90
Average:            2      0.10      0.00      0.10      0.10      0.00     99.70
Average:            3      0.00      0.00      0.00      0.00      0.00    100.00
Average:            4      0.00      0.00      0.10      0.00      0.00     99.90
Average:            5      0.10      0.00      0.10      0.00      0.00     99.80
Average:            6      0.10      0.00      0.00      0.00      0.00     99.90
Average:            7      0.10      0.00      0.00      0.00      0.00     99.90

If I cd over to the /var/log/sa directory, I see that sar has been collecting performance data for a while and is retaining nine days' worth.

# cd /var/log/sa
# ls
sa14  sa16  sa18  sa20  sa22   sar14  sar16  sar18  sar20
sa15  sa17  sa19  sa21  sar13  sar15  sar17  sar19  sar21

While you might not be inclined to run the sar commands shown above every day, it's a good idea to monitor performance routinely. One way to do this is to set up a script that emails you some of this data every day.

Photo Credit: 

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

IT ManagementWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Ask a Question