APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

sysstat (iostat,mpstat,sar) and maybe u386mon

© Tony Lawrence, aplawrence.com

The sysstat package is a set of tools that those of us from the Unix world sorely missed on Linux.

Most missed was sar. A few years back, SCO had released sar so that it could be ported to Linux, but the initial work was slow and lacked many features. I'm glad to see that's all changed.

When I mention this to Linux folk, the first reaction is usually "What do I need that for? It's all in /proc!". Well, that's not really the point.

The value of sar (for those not familiar with it) is that it collects statistics through cron (the sysstat rpm automatically installs a "sysstat" job in /etc/cron.d for this). You can examine the results at your leisure, but more importantly this means that you can see what "normal" performance looks like for your system, which is critically important in diagnosing sudden problems.

Without any flags, sar reports cpu usage:

07:00:00 AM       CPU     %user     %nice   %system   %iowait     %idle
07:10:00 AM       all      0.27      0.00      0.14      0.06     99.53
07:20:00 AM       all      1.22      0.00      1.58      0.41     96.80
07:30:00 AM       all      0.14      0.00      0.09      0.00     99.76
07:40:00 AM       all      0.30      0.00      0.39      0.19     99.11

A neat feature of sar I wasn't aware of is the ability to run it against a specific process id:

# sar -x 29801  5 50

07:03:12 AM       PID  minflt/s  majflt/s     %user   %system   nswap/s   CPU
07:03:17 AM     29801      0.00      0.00      0.00      0.00      0.00     0
07:03:22 AM     29801      1.60      0.00      0.20      0.00      0.00     0
07:03:27 AM     29801      1.60      0.00      0.00      0.20      0.00     0
07:03:32 AM     29801      1.40      0.00      0.20      0.00      0.00     0

Many other reports are available; see the man page. Through a "sa2" script (enabled in the sysstat crontab), daily ASCII versions of full sar reports are produced in the /var/log/sa directory.

The iostat command concentrates on i/o:

avg-cpu:  %user   %nice    %sys %iowait   %idle
           0.73    0.06    0.83    1.56   96.82

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
hdd               3.28       100.00         1.95   50382778     981856
hdd1              0.00         0.00         0.00         16          0
hdd2              0.00         0.00         0.00        112          0
hdd3              3.28       100.00         1.95   50382330     981856
hda               8.83       379.38        24.96  191146538   12574646
hda1              0.00         0.21         0.00     107528       1534
hda2              8.80       379.04        24.74  190971418   12464952
hda3              0.02         0.13         0.21      67272     108160

You can specify a particular device also:

iostat /dev/hda

avg-cpu:  %user   %nice    %sys %iowait   %idle
           0.73    0.06    0.83    1.56   96.82

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
hda               8.82       379.22        24.95  191146538   12578110

On more recent kernels, "iostat -x" displays even more information. Finally, "mpstat", shows cpu specific data and can report on multiple cpu's if present:

09:04:35 AM  CPU   %user   %nice %system %iowait    %irq   %soft   %idle    intr/s
09:04:35 AM  all    0.73    0.06    0.76    1.56    0.06    0.00   96.82    122.40

Of course with any of these, understanding the information presented is the hard part. The man pages are short on details, and even if you track some of these to their source, it can still be difficult to understand what a particular statistic implies about the state of your system and what, if anything, you should do about it. So much to learn, so little time..

CPU usage from u386mon

The u386mon is like "top", with multiple pages showing network statistics, kernel and memory statistics and a dynamic display of highest cpu using processes.

Interestingly, there are multiple references in Google talking about porting u386mon to Linux, but I can't find where anyone acutally has.

I did find source at SCO (but no SCO binary).

Apparently the port was attempted by Warren Tucker - see the note at the very bottom of this "panel" man page.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> sysstat (iostat,mpstat,sar) and maybe u386mon


More Articles by

Find me on Google+

Tony Lawrence

Click here to add your comments
- no registration needed!

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments

If you want a picture to show with your comment, go get a Gravatar
Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Jump to Comments

Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

I am a Kerio reseller. Articles here related to Kerio products reflect my honest opinion, but I do have an obvious interest in selling those products also.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

This post tagged: