{"id":2665,"date":"2016-09-07T17:36:31","date_gmt":"2016-09-07T21:36:31","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2665"},"modified":"2017-12-12T15:52:22","modified_gmt":"2017-12-12T20:52:22","slug":"install-use-iostat","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/","title":{"rendered":"How to install and use iostat"},"content":{"rendered":"<h1>How to install and use iostat<\/h1>\n<p>iostat, short for input\/output statistics, is a popular Linux system monitoring tool that allows users to identify a variety of performance issues as well as obtain CPU and system information from the collection of statistics it collects. These statistics, like the iostat name suggests, involve operating system storage input and output. As more than a statistics collection tool, the comprehensive overview that the iostat command provides is valuable for any system administrator.<\/p>\n<p>This tutorial will cover installing and using iostat for yourself on a Linux server.<\/p>\n<h2>Getting Started<\/h2>\n<p>The completion of this tutorial requires the following:<br \/>\n\u2022 1 Linux Server (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>)<\/p>\n<h2>Tutorial<\/h2>\n<p>The process of installing iostat is very simple. iostat is part of the sysstat package, which you can install on your respective system with one of the below commands. Linux iostat command to report CPU statistics and I\/O statistics:<\/p>\n<p><strong>CentOS<\/strong><\/p>\n<p><code>yum install sysstat<\/code><\/p>\n<p><strong>Ubuntu \/ Debian<\/strong><\/p>\n<p><code>sudo apt-get install sysstat<\/code><\/p>\n<h2>Running iostat<\/h2>\n<p>The iostat tool is accessed via its command, iostat. Enter this command to see how it works:<\/p>\n<p><code>iostat<\/code><\/p>\n<p>Here is a sample output of the sort you will when you call the iostat command:<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<br \/>\nDevice:  tps  Blk_read\/s  Blk_wrtn\/s  Blk_read   Blk_wrtn<br \/>\nsda     200.53   1022.33  1394.72    2214048305  3845623328<br \/>\nsda1    150.20    473.24  1422.29    1844686896  3295752889<br \/>\nsda2    20.00     320.12  145.21     1000012186  1668872653<\/code><\/p>\n<p>While this report may, at first glance, look complicated, understanding what the report shows is actually fairly straightforward. We will explain, section by section, what each aspect of the iostat report entails so that you can easily use the reporting for yourself:<\/p>\n<p><strong>Section 1: the CPU report<\/strong><\/p>\n<p>Within the first part of the report (the area with percentage values), you will find the CPU statistics that iostat has collected. Here we break down for you the statistics that you will find, and what they mean. For related statistics, we have added a helpful summary in bold so that you can see what is involves at an overview:<\/p>\n<p>Concerning CPU usage at the user\/application level with and without nice priority, and at the system\/kernel level:<\/p>\n<p><strong>%user:<\/strong> This column displays the percentage of CPU utilization that has occured during execution at the user\/application level.<br \/>\n<strong>%nice:<\/strong> This column also displays the percentage of CPU utilization that occurs while executing at the user level, however this time with a nice priority. This means that only commands called with the Linux command nice, which lowers priority below the standard level, are shown in this statistic.<br \/>\n<strong>%system:<\/strong> In this column, you can see the percentage of CPU utilization that occured while executing at the system (also known as kernel) level, as opposed to the above statistics.<\/p>\n<p>Concerning CPU idle and wait times:<\/p>\n<p><strong>%iowait:<\/strong> This statistic is the percentage of the time that the CPU or CPUs were idle during which the system had an outstanding disk I\/O request.<br \/>\n<strong>%steal:<\/strong> The second to last column goes on to show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.<br \/>\n<strong>%idle:<\/strong> The last column in this section shows the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I\/O (input\/output) request.<\/p>\n<p><strong>Section 2: the device utilization report<\/strong><\/p>\n<p>The second portion of the iostat report, which is oftentimes larger than the first section, lists all devices and displays statistics that concern their usage. This section is read horizontally, with each row displaying the statistics for its respective device:<\/p>\n<p><strong>Device:<\/strong> The very first column is the one that shows the device or partition name as listed in the \/dev directory is shown.<br \/>\n<strong>tps:<\/strong> This next column begins the statistics for the device, and displays the number of transfers per second (tps) that were issued to the device. A busier processor will have a higher number of these transfers.<br \/>\n<strong>Blk_read\/s:<\/strong> This statistic, blocks read per second, shows the amount of data read from the device, as expressed in a number of blocks (e.g. kilobytes, megabytes) per second.<br \/>\n<strong>Blk_wrtn\/s:<\/strong> Similarly, blocks written per second is shown with the amount of data written to the device also expressed in a number of blocks (e.g. kilobytes, megabytes) per second.<br \/>\n<strong>Blk_read:<\/strong> The total number of blocks read for each device are displayed in the second-to-last column.<br \/>\n<strong>Blk_wrtn:<\/strong> Likewise, the total number of blocks written is displayed, for each device, is in the last column.<\/p>\n<h2>Enhancing the iostat report<\/h2>\n<p><strong>1. Display megabytes instead of bytes<\/strong><\/p>\n<p>By default, iostat measures system input and output with the unit bytes. As bytes are so small, for easier comprehensibility by humans we can convert the report to instead display reports with megabytes, which are significantly larger and much easier to understand at first sight. Call iostat using the -m flag to display megabytes inside the reports:<\/p>\n<p><code>iostat -m<\/code><\/p>\n<p>Notice how the output now changes to show megabytes as desired, as seen in this sample output:<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<br \/>\nDevice:  tps   MB_read\/s MB_wrtn\/s  MB_read  MB_wrtn<br \/>\nsda     200.53    0.62      0.74    1032680  1742461<br \/>\nsda1    150.20    0.29      0.64    1002131  1204562<br \/>\nsda2    20.00     0.17      0.14     393451   322456<\/code><\/p>\n<p><strong>2. Display extended status<\/strong><\/p>\n<p>While the original report still contains a lot of useful information, we can obtain even more information by using the flag -x with the iostat command in order to display extended reports:<\/p>\n<p><code>iostat -x<\/code><\/p>\n<p>The output of iostat will now also include extended disk I\/O statistics information as shown in this sample below. Note that we have shown the output wrapped as the header information line for the device columns is very long in comparison to before:<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<br \/>\nDevice:  rrqm\/s  wrqm\/s   r\/s     w\/s     rsec\/s   wsec\/s  \\<br \/>\nsda     7684.00  19.00   2420.00  523.00  81848.00 5287.00  \\<br \/>\n         avgrq-sz  avgqu-sz  await  svctm  %util<br \/>\n         29.86     32.99     11.17  0.34   100.00<\/code><\/p>\n<p>To understand what the new extended columns mean, you can look in the man page for iostat either online or with the command:<\/p>\n<p><code>man iostat<\/code><\/p>\n<p><strong>3. Run iostat with a delay<\/strong><\/p>\n<p>It is possible to tell iostat to take multiple reports with a delay known as the interval. This is done with a number parameter given to the iostat command. However, if only the interval parameter is given, then iostat will run continuously generating reports on that interval until you stop it! So we will also provide a second parameter known as the count parameter, which is also a number.<\/p>\n<p>These are given to iostat in the form:<\/p>\n<p><code class=\"gris\">iostat [OPTIONS] [INTERVAL] [COUNT]<\/code><\/p>\n<p>For an example situation where we want to generate three reports with a three-second interval between reports, and showing megabytes, run the command:<\/p>\n<p><code>iostat -m 3 3<\/code><\/p>\n<p>The last two numbers in the above command represent the interval parameter and the count parameter. The interval parameter, the first 3 in the example, tell iostat to wait three seconds between each report, with each subsequent report containing statistics for the time since the previous report. The count parameter, the second 3 in the example, tells iostat how many reports should be generated in total. Returning to our example, the output should now look similar to the following:<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<br \/>\nDevice:  tps   MB_read\/s MB_wrtn\/s  MB_read  MB_wrtn<br \/>\nsda     200.53    0.62      0.74    1032680  1742461<br \/>\nsda1    150.20    0.29      0.64    1002131  1204562<br \/>\nsda2    20.00     0.17      0.14     393451   322456<\/code><\/p>\n<p>Three seconds pass.<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<br \/>\nDevice:  tps   MB_read\/s MB_wrtn\/s  MB_read  MB_wrtn<br \/>\nsda     200.53    0.62      0.74    1032680  1742461<br \/>\nsda1    150.20    0.29      0.64    1002131  1204562<br \/>\nsda2    20.00     0.17      0.14     393451   322456<\/code><\/p>\n<p>Three seconds pass.<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<br \/>\nDevice:  tps   MB_read\/s MB_wrtn\/s  MB_read  MB_wrtn<br \/>\nsda     200.53    0.62      0.74    1032680  1742461<br \/>\nsda1    150.20    0.29      0.64    1002131  1204562<br \/>\nsda2    20.00     0.17      0.14     393451   322456<\/code><\/p>\n<p><strong>4. Display only one report section<\/strong><\/p>\n<p>Iostat also lets you modify the report to show only the first CPU section or only the second disk section. To show only the CPU statistics, we can use the -c flag with iostat with the command:<\/p>\n<p><code>iostat -c<\/code><\/p>\n<p>We will use the example situation where we want to show the CPU section only, using a two-second interval, and display the information five times (that is, make five reports total with one report every two seconds for only the CPU section). For this, execute the following command:<\/p>\n<p><code>iostat -c 2 5<\/code><\/p>\n<p>The output will now look something like the following:<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<\/code><\/p>\n<p>Two seconds pass.<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<\/code><\/p>\n<p>Two seconds pass.<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<\/code><\/p>\n<p>Two seconds pass.<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<\/code><\/p>\n<p>Two seconds pass.<\/p>\n<p><code class=\"gris\">Linux 2.6.32x86_64 (dev-db) 01\/01\/2016<br \/>\navg-cpu:  %user  %nice  %system  %iowait  %steal  %idle<br \/>\n           5.00    0.00    0.50    2.00    0.00    92.50<\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>This guide has shown the basics of using the iostat system monitoring and statistics tool for your Linux system. More information about possible modifications to the reports can be found in the online man page for iostat in order to get the most you can out of them. If you found this introduction to iostat useful, share it with your friends! <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How to install and use iostat iostat, short for input\/output statistics, is a popular Linux system monitoring tool that allows users to identify a variety of performance issues as well as obtain CPU and system information from the collection of statistics it collects. These statistics, like the iostat name suggests, involve operating system storage input<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[],"class_list":["post-2665","post","type-post","status-publish","format-standard","hentry","category-monitoring","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to install and use iostat - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to install and use iostat on your server. iostat commands provide valuable information for system administrator.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to install and use iostat - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to install and use iostat on your server. iostat commands provide valuable information for system administrator.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-07T21:36:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-12T20:52:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/\",\"name\":\"How to install and use iostat - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\"},\"datePublished\":\"2016-09-07T21:36:31+00:00\",\"dateModified\":\"2017-12-12T20:52:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to install and use iostat on your server. iostat commands provide valuable information for system administrator.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.globo.tech\/learning-center\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to install and use iostat\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\/\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to install and use iostat - Globo.Tech","description":"This tutorial will show you how to install and use iostat on your server. iostat commands provide valuable information for system administrator.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/","og_locale":"en_US","og_type":"article","og_title":"How to install and use iostat - Globo.Tech","og_description":"This tutorial will show you how to install and use iostat on your server. iostat commands provide valuable information for system administrator.","og_url":"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/","og_site_name":"Globo.Tech","article_published_time":"2016-09-07T21:36:31+00:00","article_modified_time":"2017-12-12T20:52:22+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/","url":"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/","name":"How to install and use iostat - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-09-07T21:36:31+00:00","dateModified":"2017-12-12T20:52:22+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to install and use iostat on your server. iostat commands provide valuable information for system administrator.","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/install-use-iostat\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to install and use iostat"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2665"}],"version-history":[{"count":6,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2665\/revisions"}],"predecessor-version":[{"id":3997,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2665\/revisions\/3997"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}