20 iostat Commands Examples in Linux / UNIX | iostat Commands Tutorial

iostat command is a command that used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat create reports that can be used to change system configuration to better balance the input/output between physical disks.
You can use iostat command which report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions. It can be use to find out your system’s average CPU utilization since the last reboot.
Reports Central Processing Unit (CPU) statistics, asynchronous input/output (AIO) and input/output statistics for the entire system, adapters, TTY devices, disks CD-ROMs, tapes and file systems.
Note:
iostat reports CPU, disk I/O, and NFS statistics.
vmstat reports virtual memory statistics.
mpstat reports processors statictics.
How to install iostat?
1. Ensure you are logged in as ‘root’
‘iostat’ and ‘vmstat’ are apart of the ‘sysstat’ package and should be installed by default
2. Verify installation :
# rpm -qa | grep -i sysstat
3. Installation, if needed :
# rpm -ivh <name>
4. If you have connectivity to RHN or a Satellite Server:
# yum install sysstat
5. If you are using Ubantu:
# apt-get install sysstat
1. iostat – Basic example, Iostat without any argument displays information about the CPU usage, and I/O statistics about all the partitions on the system as shown below.
$ iostat
2. iostat – Display only cpu statistics. iostat option -c, displays only the CPU usage statistics as shown below.
$ iostat -c
3. iostat – Display only disk I/O statistics. iostat option -d, displays only the disk I/O statistics as shown below.
$ iostat -d
4. iostat – Display only network statistics. iostat option -n, displays only the device and NFS statistics as shown below.
$ iostat -n
5. iostat – Display I/O data in MB/second. By default iostat, displays the device I/O statistics in Blocks. To change it to MB, use -m as shown below.

$ iostat -m

6. iostat – Display I/O statistics only for a device. By default iostat displays I/O data for all the disks available in the system. To view statistics for a specific device (For example, /dev/sda), use the option -p as shown below.
$ iostat -p sda
7. iostat – Display timestamp information, By default iostat displays only the current date. To display the current time, use the option -t as shown below.
$ $ iostat -t
8. iostat – Display Extended status, Use option -x, which will displays extended disk I/O statistics information as shown below.
$ iostat -x
9. To display extended information for a specific partition (For example, /dev/sda1), do the following.
$ iostat -x sda1
10. iostat – Execute Every x seconds (for y number of times). To execute iostat every 2 seconds (until you press Ctl-C), do the following.
$ iostat 2
11.To execute every 2 seconds for a total of 3 times, do the following.
$ iostat 2 3
12. iostat – Display LVM statistic (and version)
$ iostat -N
13. To display the version of iostat, use -V. This will really display the version information of sysstat, as iostat is part of sysstat package.
$ iostat -V
Reference
iostat use these files to create reports…
/proc/stat which contains system statistics
/proc/partitions which contains disk statistics (for pre 2.5 kernel that have been patched)
/proc/diskstats contains disks statistics (for post 2.5 kernel)
/sys which contains statistics for block devices (post 2.5 kernel)
Tagged : / / / / / / / / /

Linux Performance Monitoring using iostat, mpstat and vmstat | Linux Performance Monitoring Guide

linux-performance-monitoring

iostat reports CPU, disk I/O, and NFS statistics.

mpstat reports processors statictics.
vmstat reports virtual memory statistics.

vxstat – This Utility can be used as well.

iostat reports CPU, disk I/O, and NFS statistics.

The iostat command generates two types of reports, the CPU Utilization report and the Device Utilization report. The first report generated by the iostat command is the CPU Utilization Report.

iostat commands Table
iostat Iostat without any argument displays information about the CPU usage, and I/O statistics
iostat -c Display only cpu statistics
iostat -d Display only disk I/O statistics
iostat -n Display only network statistics (device and NFS statistics)
iostat -m Display the device I/O statistics in Blocks and To change I/O data in MB/second
iostat –p Display I/O statistics only for a device(data for all the disks available in the system)
iostat -t By default iostat displays only the current date. To display the current time, use this option
iostat -x Display extended disk I/O statistics information
iostat -x sda1 Display Extended status of device sda1
iostat 2 Execute Every 2 seconds (until you press Ctl-C)
iostat 2 3 To execute every 2 seconds for a total of 3 times
iostat -N To display the LVM statistics use option -N as shown below.
iostat –V To Display Version
iostat -d -x Display only disk I/O statisticsin in extended form
iostat -d -x sda Display only sda device I/O statisticsin in extended form
iostat -Td -xdn 5 For Solaris
iostat -d -x 5 For Linux
if Average read or write times over 50 ms, this should be consider for serious i/o problems

The report has the following format:

%user – Show the percentage of CPU utilization that occurred while executing at the user level (application).
%nice – provides statistics on a per physical device or partition basis.
Device – This column gives the device name
tps – Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request to the device.
Blk_read/s – Indicate the amount of data read from the drive expressed in a number of blocks per second.
Blk_wrtn/s – Indicate the amount of data written to the drive expressed in a number of blocks per second.
Blk_read – The total number of blocks read.
Blk_wrtn – The total number of blocks written.
kB_read/s – Indicate the amount of data read from the drive expressed in kilobytes per second.
kB_wrtn/s – Indicate the amount of data written to the drive expressed in kilobytes per second.
wrqm/s – The number of write requests merged per second that were issued to the device.
r/s – The number of read requests that were issued to the device per second.
w/s – The number of write requests that were issued to the device per second.
rsec/s – The number of sectors read from the device per second.
wsec/s – The number of sectors written to the device per second.
await – The average time (in milliseconds) for I/O requests issued to the device to be served.
svctm – The average service time (in milliseconds) for I/O requests that were issued to the device.
%util – Percentage of CPU time during which I/O requests were issued to the device.

vmstat reports virtual memory statistics.

vmstat -a Display active and inactive memory
vmstat -f Display number of forks since last boot
vmstat 2 Execute Every x seconds (for y number of times)
vmstat -t 1 100 Display timestamp
vmstat -V version info
vmstat -m Display slab info
vmstat -s Display statistics in a table format
vmstat -d Use option -d to display the disk statistics as shown below. This displays the reads, writes, and I/O statistics of the disk.
vmstat 1 3 vmstat – Increase the width of the display
vmstat -p sdb1 Display statistics for a partition
vmstat -S m Display in MB

The report has the following format:

Procs – r: Total number of processes waiting to run
Procs – b: Total number of busy processes
Memory – swpd: Used virtual memory
Memory – free: Free virtual memory
Memory – buff: Memory used as buffers
Memory – cache: Memory used as cache.
Swap – si: Memory swapped from disk (for every second)
Swap – so: Memory swapped to disk (for every second)
IO – bi: Blocks in. i.e blocks received from device (for every second)
IO – bo: Blocks out. i.e blocks sent to the device (for every second)
System – in: Interrupts per second
System – cs: Context switches
CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time

mpstat reports processors statictics.

reports processors statictics(mpstat – Report processors related statistics and mpstat displays CPU statistics )

mpstat :- mpstat displays CPU statistics
mpstat -A :- Display all information
mpstat -P ALL :- Display CPU statistics of individual CPU (or) Core

Reference:
http://www.linux-tutorial.info/modules.php?name=ManPage&sec=1&manpage=iostat
http://www.thegeekstuff.com/2011/07/iostat-vmstat-mpstat-examples/

Tagged : / / / / / / / / / / / / / / / / / / /