2.5.4. The Sysstat Suite of Resource Monitoring Tools

While the previous tools may be helpful for gaining more insight into system performance over very short time frames, they are of little use beyond providing a snapshot of system resource utilization. In addition, there are aspects of system performance that cannot be easily monitored using such simplistic tools.
Therefore, a more sophisticated tool is necessary. Sysstat is such a tool.
Sysstat contains the following tools related to collecting I/O and CPU statistics:
Displays an overview of CPU utilization, along with I/O statistics for one or more disk drives.
Displays more in-depth CPU statistics.
Sysstat also contains tools that collect system resource utilization data and create daily reports based on that data. These tools are:
Known as the system activity data collector, sadc collects system resource utilization information and writes it to a file.
Producing reports from the files created by sadc, sar reports can be generated interactively or written to a file for more intensive analysis.
The following sections explore each of these tools in more detail. The iostat command

The iostat command at its most basic provides an overview of CPU and disk I/O statistics:
 Linux 2.4.20-1.1931. (pigdog.example.com) 07/11/2003 avg-cpu: %user %nice %sys %idle 6.11 2.56 2.15 89.18 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn dev3-0 1.68 15.69 22.42 31175836 44543290 
Below the first line (which contains the system's kernel version and hostname, along with the current date), iostat displays an overview of the system's average CPU utilization since the last reboot. The CPU utilization report includes the following percentages:
  • Percentage of time spent in user mode (running applications, etc.)
  • Percentage of time spent in user mode (for processes that have altered their scheduling priority using nice(2))
  • Percentage of time spent in kernel mode
  • Percentage of time spent idle
Below the CPU utilization report is the device utilization report. This report contains one line for each active disk device on the system and includes the following information:
  • The device specification, displayed as dev<major-number>-sequence-number, where <major-number> is the device's major number[6], and <sequence-number> is a sequence number starting at zero.
  • The number of transfers (or I/O operations) per second.
  • The number of 512-byte blocks read per second.
  • The number of 512-byte blocks written per second.
  • The total number of 512-byte blocks read.
  • The total number of 512-byte block written.
This is just a sample of the information that can be obtained using iostat. For more information, refer to the iostat(1) man page.

[6] Device major numbers can be found by using ls -l to display the desired device file in /dev/. The major number appears after the device's group specification.