Revision as of 14:37, 3 April 2015 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Commonly misspelled as systat.

Warning: all these commands take optional arguments for sample period and number of samples. You should always use these options. If you don't include these options then the reports default to showing the avarage statistics since the last boot, which almost never what you want.

You might also want to look at the dstat package, which has replacements for many of the commands in sysstat.


When you run iostat without any arguments it shows average statistics since the last boot. If your server has been on for years then this isn't going to be very useful. Instead, you need to give iostat a time interval to average and the number of times to report. You need to ask for at least two reports because the first shows the average since last boot. For example, the following averages over 10 seconds and prints two reports (report average since boot and report average over last 10 seconds):

iostat 10 2

It is often useful to filter out the devices that have zero input and output since the last report. Equivalent to iostat 3 | egrep -v "[0]+space:+[0]+$".

iostat -z 3
If you are working with a virtualization system using LVM then it's very useful to see the device mapper name instead of device name. This makes it easier to see which guest is using IO.
iostat -z -N 3

mpstat -- CPU usage and CPU interrupt counts

This tool generates reports on processor utilization and interrupts.

# Reports processor percentage utilization in various parts of the system: 
# idle, sys, usr, iowait, hardware IRQ, etc. over a 10 second period of time, stops after one report.
mpstat -P ALL -u 10 1
# Reports total number of all interrupts per processor over a 10 second period, stops after one report.
mpstat -P ALL -I SUM 10 1
# Reports total for each type of interrupt pre processor over a 10 second period, stops after one report.
mpstat -P ALL -I ALL 10 1

Combine both reports into one.

# Reports on processor utilizatoin and interrupt statistics over a 1 second period, stops after one report.
mpstat -P ALL -I ALL -u 1 1


"sysstat" is the best package to find sar

Under Ubuntu the sar command is part of the sysstat package. Do not confuse this with atsar, which is obsolete and unmaintained.

After sysstat in installed be sure to enable data collection by editing /etc/default/sysstat and setting ENABLED="true".

Requested activities not available in file

This happens most often when sysstat was not configured to record the given data. For example, `sar -b` or `sar -d`. You must edit /etc/cron.d/sysstat and add the option to store the given dataset.