Iostat



Iostat

iostat (input/output statistics) an utility that reports Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions. The iostat command is used for monitoring system input/output device performance.  This is quite handy to identify which partition is being heavily used and if any HW issues exists.  The details regarding the various parameters will make this article quite confusing. So I am focusing on the values which needs to be monitored during a suspected server issue.




# iostat -x


 As you can see from the result the first part  explains the IO activities for the cpu.  You can get the CPU performance alone using the following command-line.



# iostat -c



An explanation for all parameters here will lead to ambiguity. So we are focusing on the most crucial one is  %iowait and %idle . A high iowait on this section indicates that the cpu is incapable of handling all incoming requests and hence the requests are held in queue indicating a degraded performance.  The %idle parameter indicates the cpu idle time. A high value here indicates that CPU is not busy.  On the above example we can assume that 7.94 % of total IO requests are in queue while 59.54% of CPU clocks are idle.

The second portion  on the output shown earlier explains the IO activities for various disks attached to the server. The disk details alone can be obtained by using the switch “-d “



#iostat -xd


The most crucial parameters on this result are   svctm  %util . Let  us see what they mean and its importance.

svctm

The number of milliseconds spent servicing requests, from beginning to end, including queue time and the time the device actually takes to fulfill the request.

%util

The percentage of CPU time during which requests were issued. This really shows the device utilization, as the name implies, because when the value approaches 100%, the device is saturated.

As you can see from the above example,  for  sda3 and sda4 svctm and util  stays at that high range of level indicating high activities on the mentioned partitions.  Now let us see which partition is mounted on these particular HDD.


# df -h

Here the active partitions are /var and /usr.  Now check the processes which actively uses, these partitions. In this case,  it was mysql abuse and the data directory was configured as /var.  Stopping the attack restored normalcy for the IO activities.

# iostat -xm 2

For continues monitoring of disk io, specify the time in second as an argument.





No comments: