Monitor Linux Systems Performance with iostat command

iostat command is used to monitor CPU utilization and I/O (input /output) statistics of all the disks and file systems. nfsiostat command is used to monitor i/o statistics of network file system(NFS).

iostat command monitor the I/O (Input/Output) devices loading by means of observing the time, devices are active with respect to their average transfer rates. This command is especially helpful for generating reports that we can use to optimize the system’s input & output load.

iostat command generally generates two reports:

  • CPU utilization report
  • All disks i/o statistics report

To generate the reports, iostat command reads some of the system files . These files are,

  • /proc/diskstats for disk stats
  • /proc/stat for system stats
  • /sys for block device stats
  • /proc/devices for persistent device names
  • /proc/self/mountstats for all  the network filesystems
  • /proc/uptime for information regarding system uptime

In this tutorial, we will learn how to install iostat utility on Linux systems and then we will discuss how to generate reports using iostat command,

Iostat Installation on centos 7

iostat is a part of ‘sysstat‘ package, we can install it on our system using the following command,

yum install sysstat -y

Now let’s check out some examples to understand the iostat command better.

Example:1 Get complete statistics (CPU & Devices)

To get the complete statistics for the system, open terminal & execute the following command,

 iostat

Here in the iostat command output,

  • %user, is CPU utilization for the user,
  • %nice, is the CPU utilization for apps with nice priority,
  • %system, is the CPU being utilized by the system,
  • %iowait, is the time percentage during which CPU was idle but there was an outstanding i/o request,
  • %steal, percentage of time CPU was waiting as the hypervisor was working on another CPU,
  • %idle, is the percentage of time system was idle with no outstanding request.

Devices, shows the name of all the devices on system,

  • Tps, is the short for transfer per second,
  • Blk_read/s & Blk_write/s are the transfer speed for read and write operations,
  • Blk_read & Blk_write shows the total number of blocks read & written.

Example:2 Generate only CPU stats

Example:3 To Generate i/o statistics for all the devices (-d option) 

To get the iostat report only for the devices connected on the system, we will use option ‘d’ with iostat command,

iostat -d

Example:4 Generate detailed i/o statistics

Though usually the stats provide by iostat command are sufficient but if you wish to get even more detailed statistics, we can use ‘-x’ option along with iostat command. Example is shown below,

iostat -x

Example:5 Generate the LVM statistics report

 iostat -N 

These are the major iostat commands to Monitor Linux Systems Performance.

Related posts

Leave a Comment