Linux iostat is part of the sysstat utilities. iostat command is mainly used to track input output related events and issues. iostat command can provide metrics, information and statistics about input and output.
Iostat is installed with sysstat tools which is explained in the following page.
Help about iosstat can be get with
--help options like below.Simple help provides information about the syntax too.
$ iostat --help
iostat have different usage types. Using without parameters like below will print information about cpu usage and disk statistics.
Display Only CPU Statistics
Only CPU information can be listed with
-c option like below. This will print information like average CPU usage with related user, system, idle values. Also systems kernel version host name CPU count and CPU architecture is printed too.
$ iostat -c
Display Only Disk Statistics
Only disk information about the system can be listed with
-d option. This options will provide information like tps,read, write KB.
$ iostat -d
Display Single Disk Statistics
In previous example we have printed information about all connected disks. there is also option for only list single disk information. We will just provide the disk path after the option
-d like below.
$ iostat -d /dev/vda
Display As MB(Megabyte)
Up to now we have used default option about size. This can be changed to make it more human readable. iostat output can be provided with mega byte with
-m . In the following example read, write values are presented as MB
$ iostat -m -d
Display Time stamps
While using iostat in a interval refresh state we will need time stamp for each print. This can be printed with
-t parameter like below.
$ iostat -t -d
Display Extended Status
In previous example we used options to print major metrics but there is a lot of metrics and statistics about this subsystems. This extended information provides more detailed metric about the subsystem.
$ iostat -x
Set Refresh Interval
One of the best feature is refreshing iostat command at specified intervals. This interval can be specified with just providing seconds like below. In this example we use 2 seconds for interval value.
$ iostat 2 -d