AMP AMP

How to Monitor Linux performance statistics using iostat

To Monitor the Linux CPU and I/O statistics using iostat

The iostat is a system monitor tool to collect and display operating system input and output storage statistics. It provides information about terminal (TTY) input and output.

iostat without using any option

Run the below command to start iostat.

[root@linuxhelp Desktop]# iostat
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.81    0.00    0.63    0.80    0.00   94.77

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.91       228.55        49.53    5817171    1260682

To view the version of the iostat

To view the version of the iostat by using &ndash V option.

[root@linuxhelp Desktop]# iostat -V
sysstat version 9.0.4
(C) Sebastien Godard (sysstat  orange.fr)

To display the statistic report with time interval and line count

[root@linuxhelp Desktop]# iostat 2 3
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.84    0.00    0.64    0.81    0.00   94.72

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.96       228.90        50.14    5885459    1289066

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           4.55    0.00    0.51    0.00    0.00   94.95

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               0.00         0.00         0.00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           6.09    0.00    1.02    0.00    0.00   92.89

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               1.02         0.00        89.34          0        176

To know CPU information

If you want to know only CPU information , then use iostat command with option -c.

[root@linuxhelp Desktop]# iostat -c
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
3.85    0.00    0.64          0.80        0.00   94.71

To know only disk statistics information

If you want to know only disk statistics information , then use iostat command with option -d.

[root@linuxhelp Desktop]# iostat -d
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.91       223.91        49.46    5916563    1307010

To check the specific device status information

If you want to check the specific device status information by using -p with iostat command.
The below command will display all device information.

[root@linuxhelp Desktop]# iostat -p
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.95    0.00    0.63    0.79    0.00   94.63

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.87       219.98        48.96    5922747    1318146
sda1              0.02         0.17         0.00       4646         18
sda2              2.70       216.42        38.92    5827106    1047808
sda3              0.11         3.25        10.04      87624     270320
sda4              0.00         0.00         0.00         12          0
sda5              0.03         0.07         0.00       1951          0

To display only the specific information statistic

The below command will display only the specific information statistic.

[root@linuxhelp Desktop]# iostat -p sda1
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.95    0.00    0.63    0.79    0.00   94.63

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn

To display the only network statistic information

To display the only network statistic information by using -n with iostat command.

[root@linuxhelp Desktop]# iostat -n
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

Filesystem:              rBlk_nor/s   wBlk_nor/s   rBlk_dir/s   wBlk_dir/s   rBlk_svr/s   wBlk_svr/s     ops/s    rops/s    wops/s

To display memory statistic information

To display memory statistic information in MB (megabyte) format by using option -m with iostat command.

[root@linuxhelp Desktop]# iostat &ndash m
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.93    0.00    0.63    0.79    0.00   94.64

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
sda               2.88         0.11         0.02       2891        640

To view specific extended disk I/O statistic information

The below command shows the specific extended disk I/O statistic information’ s, with using option -x.

[root@linuxhelp Desktop]# iostat -x sda2
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           4.01    0.00    0.63    0.77    0.00   94.59

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda2              0.87     4.09    1.91    0.74   210.75    38.67    94.21     0.05   17.38   3.94   1.04

To display the time-stamp on your iostat

If you want to display the time-stamp on your iostat output just use -t option with iostat command.

[root@linuxhelp Desktop]# iostat &ndash t
Linux 2.6.32-573.18.1.el6.x86_64 (linuxhelp.com)     04/01/2016     _x86_64_    (1 CPU)

04/01/2016 08:16:53 PM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           4.02    0.00    0.63    0.76    0.00   94.58

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.80       212.76        48.22    5930851    1344234

To know the LVM statistic information

If you want to know the LVM statistic information use &ndash N with iostat command.

[root@linuxhelp Desktop]# iostat &ndash N
Tag : iostat
FAQ
Q
How to display the entire detail about i/o statistics using the "iostat" command?
A
You can use the option of "-x" with "iostat" command to display the entire detail about i/o statistics using the "iostat" command. For syntax: "iostat -x"
Q
How to view the statistics for a specific partition using the "iostat" command in Linux?
A
Use the following syntax to view the statistics for a specific partition using the "iostat" command in Linux. For syntax: "iostat -m -p sdb2"
Q
How to install "iostat" on Linux?
A
You can use the following syntax to install "iostat" on Linux. For syntax: In RPM based distro "yum install sysstat",
In Debian based distro "apt-get install sysstat".
Q
How can I check the version of "iostat" tool has been installed on the system?
A
Use the option of "-V" with "iostat" command to check the version of "iostat" tool has been installed on the system. For syntax: "iostat -V".
Q
How to generate only CPU statistics using the "iostat" command?
A
You can use the option of '-c" with "iostat" command to generate only CPU statistics using the "iostat" command. For syntax: "iostat -c".