{"id":11533,"date":"2019-03-14T11:15:57","date_gmt":"2019-03-14T11:15:57","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11533"},"modified":"2019-03-14T11:15:57","modified_gmt":"2019-03-14T11:15:57","slug":"dstat-a-resourceful-tool-to-monitor-linux-server-performance-in-real-time","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/14\/dstat-a-resourceful-tool-to-monitor-linux-server-performance-in-real-time\/","title":{"rendered":"Dstat \u2013 A Resourceful Tool to Monitor Linux Server Performance in Real-Time"},"content":{"rendered":"<p>Some of the popular and frequently used system resource generating tools available on the Linux platform include\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-performance-monitoring-with-vmstat-and-iostat-commands\/\" target=\"_blank\" rel=\"noopener\">vmstat<\/a>,\u00a0<a href=\"https:\/\/www.tecmint.com\/20-netstat-commands-for-linux-network-management\/\" target=\"_blank\" rel=\"noopener\">netstat<\/a>,\u00a0<a href=\"https:\/\/www.tecmint.com\/sysstat-commands-to-monitor-linux\/\" target=\"_blank\" rel=\"noopener\">iostat<\/a>,\u00a0<strong>ifstat<\/strong>\u00a0and\u00a0<a href=\"https:\/\/www.tecmint.com\/install-sysstat-in-linux\/\" target=\"_blank\" rel=\"noopener\">mpstat<\/a>. They are used for reporting statistics from different system components such as virtual memory, network connections and interfaces, CPU, input\/output devices and more.<\/p>\n<p>As a system administrator, you may be looking for that one tool that can give your a good amount of the information provided by above tools, even more, a single and powerful tool that has additional features and capabilities, then look no further than\u00a0<code>dstat<\/code>.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/command-line-tools-to-monitor-linux-performance\/\" target=\"_blank\" rel=\"noopener\">20 Command Line Tools to Monitor Linux Performance<\/a><\/p>\n<p><strong>dstat<\/strong>\u00a0is a powerful, flexible and versatile tool for generating Linux system resource statistics, that is a replacement for all the tools mentioned above. It comes with extra features, counters and it is highly extensible, users with Python knowledge can build their own plugins.<\/p>\n<h4>Features of dstat:<\/h4>\n<ol>\n<li>Joins information from vmstat, netstat, iostat, ifstat and mpstat tools<\/li>\n<li>Displays statistics simultaneously<\/li>\n<li>Orders counters and highly-extensible<\/li>\n<li>Supports summarizing of grouped block\/network devices<\/li>\n<li>Displays interrupts per device<\/li>\n<li>Works on accurate timeframes, no timeshifts when a system is stressed<\/li>\n<li>Supports colored output, it indicates different units in different colors<\/li>\n<li>Shows exact units and limits conversion mistakes as much as possible<\/li>\n<li>Supports exporting of CSV output to Gnumeric and Excel documents<\/li>\n<\/ol>\n<h3>How to Install dstat in Linux Systems<\/h3>\n<p>dstat is available to install from default repositories on most Linux distributions, you can install and use it for monitoring a Linux system in the process of performance tuning tests or troubleshooting exercises.<\/p>\n<pre># yum install dstat             [On <strong>RedHat\/CentOS<\/strong> and <strong>Fedora<\/strong>]\r\n$ sudo apt-get install dstat    [On <strong>Debian<\/strong>, <strong>Ubuntu<\/strong> and <strong>Linux Mint<\/strong>]<\/pre>\n<p>It works in real-time, outputting selective information in columns, including the magnitude and units for stats displayed after every one second, by default.<\/p>\n<p><strong>Note<\/strong>: The\u00a0<strong>dstat<\/strong>\u00a0output is aimed specifically for human interpretation, not as input for other tools to process.<\/p>\n<p>Below is an output seen after running the\u00a0<strong>dstat<\/strong>\u00a0command without any options and arguments (similar to using\u00a0<code>-cdngy<\/code>\u00a0(default) options or\u00a0<code>-a<\/code>\u00a0option).<\/p>\n<pre>$ dstat \r\n<\/pre>\n<div id=\"attachment_22683\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Monitoring.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-22683\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Monitoring.png\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Monitoring.png 804w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Monitoring-768x399.png 768w\" alt=\"Dstat - Linux Performance Statistics Monitoring\" width=\"804\" height=\"418\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Dstat \u2013 Linux Performance Statistics Monitoring<\/p>\n<\/div>\n<p>The output above indicates:<\/p>\n<ol>\n<li><strong>CPU stats<\/strong>: cpu usage by a user (usr) processes, system (sys) processes, as well as the number of idle (idl) and waiting (wai) processes, hard interrupt (hiq) and soft interrupt (siq).<\/li>\n<li><strong>Disk stats<\/strong>: total number of read (read) and write (writ) operations on disks.<\/li>\n<li><strong>Network stats<\/strong>: total amount of bytes received (recv) and sent (send) on network interfaces.<\/li>\n<li><strong>Paging stats<\/strong>: number of times information is copied into (in) and moved out (out) of memory.<\/li>\n<li><strong>System stats<\/strong>: number of interrupts (int) and context switches (csw).<\/li>\n<\/ol>\n<p>To display information provided by\u00a0<code>vmstat<\/code>, use the\u00a0<code>-v<\/code>\u00a0or\u00a0<code>--vmstat<\/code>\u00a0option:<\/p>\n<pre>$ dstat --vmstat\r\n<\/pre>\n<div id=\"attachment_22684\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Process-and-Memory-Monitoring.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-22684\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Process-and-Memory-Monitoring.png\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Process-and-Memory-Monitoring.png 804w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Linux-Process-and-Memory-Monitoring-768x399.png 768w\" alt=\"Dstat - Linux Process and Memory Monitoring\" width=\"804\" height=\"418\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Dstat \u2013 Linux Process and Memory Monitoring<\/p>\n<\/div>\n<p>In the image above, dstat displays:<\/p>\n<ol>\n<li><strong>Process stats<\/strong>: number of running (run), blocked (blk) and new (new) spawned processes.<\/li>\n<li><strong>Memory stats<\/strong>: amount of used (used), buffered (buff), cached (cach) and free (free) memory.<\/li>\n<\/ol>\n<p>I already explained at the last three sections (<strong>paging<\/strong>,\u00a0<strong>disk<\/strong>\u00a0and\u00a0<strong>system<\/strong>\u00a0stats) in the previous example.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/install-sysstat-in-linux\/\" target=\"_blank\" rel=\"noopener\">Sysstat \u2013 All-in-One System Performance and Usage Activity Monitoring Tool For Linux<\/a><\/p>\n<p>Let us dive into some advanced\u00a0<strong>dstat<\/strong>\u00a0system monitoring commands. In the next example, we want to monitor a single program that is using the most CPU and consuming the most amount of memory.<\/p>\n<p>The options in the command are:<\/p>\n<ol>\n<li><code>-c<\/code>\u00a0\u2013 cpu usage<\/li>\n<li><code>--top-cpu<\/code>\u00a0\u2013 process using most CPU<\/li>\n<li><code>-dn<\/code>\u00a0\u2013 disk and network stats<\/li>\n<li><code>--top-mem<\/code>\u00a0\u2013 process consuming the most memory<\/li>\n<\/ol>\n<pre>$ dstat -c --top-cpu -dn --top-mem\r\n<\/pre>\n<div id=\"attachment_22685\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Process-By-CPU-and-Memory.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-22685\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Process-By-CPU-and-Memory.png\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Process-By-CPU-and-Memory.png 804w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Process-By-CPU-and-Memory-768x399.png 768w\" alt=\"Dstat - Monitor Processes by CPU and Memory Usage\" width=\"804\" height=\"418\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Dstat \u2013 Monitor Processes by CPU and Memory Usage<\/p>\n<\/div>\n<p>Additionally, you can also store the output of dstat in a\u00a0<code>.csv<\/code>\u00a0file for analysis at a latter time by enabling the\u00a0<code>--output<\/code>\u00a0option as in the example below.<\/p>\n<p>0Here, we are displaying the time, cpu, mem, system load stats with a one second delay between\u00a0<strong>5<\/strong>\u00a0updates (counts).<\/p>\n<pre>$ dstat --time --cpu --mem --load --output report.csv 1 5 \r\n<\/pre>\n<div id=\"attachment_22686\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Linux-CPU-Memory-Load.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-22686\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Linux-CPU-Memory-Load.png\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Linux-CPU-Memory-Load.png 804w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Monitor-Linux-CPU-Memory-Load-768x399.png 768w\" alt=\"Dstat - Monitor Linux CPU Memory and Load\" width=\"804\" height=\"418\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Dstat \u2013 Monitor Linux CPU Memory and Load<\/p>\n<\/div>\n<p>There are several internal (such as options used in previous example) and external dstat plugins you can use with dstat, to view a list of all available plugins, run the command below:<\/p>\n<pre>$ dstat --list\r\n<\/pre>\n<div id=\"attachment_22687\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Plugins.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-22687\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Plugins.png\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Plugins.png 804w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/09\/Dstat-Plugins-768x399.png 768w\" alt=\"List of Dstat Plugins\" width=\"804\" height=\"418\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">List of Dstat Plugins<\/p>\n<\/div>\n<p>It reads plugins from the paths below, therefore, add external plugins in these directories:<\/p>\n<pre>~\/.dstat\/\r\n(path of binary)\/plugins\/\r\n\/usr\/share\/dstat\/\r\n\/usr\/local\/share\/dstat\/\r\n<\/pre>\n<p>For more usage information, look through the\u00a0<a href=\"https:\/\/www.tecmint.com\/wp-content\/pdf\/dstat.pdf\" target=\"_blank\" rel=\"noopener\">dstat man page<\/a>\u00a0or visit the homepage at:\u00a0<a href=\"http:\/\/dag.wiee.rs\/home-made\/dstat\/\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/dag.wiee.rs\/home-made\/dstat\/<\/a>.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-performance-monitoring-with-collectl-tool\/\" target=\"_blank\" rel=\"noopener\">Collectl: An Advanced All-in-One Performance Monitoring Tool for Linux<\/a><\/p>\n<p><strong>dstat<\/strong>\u00a0is a versatile,\u00a0<a href=\"https:\/\/www.tecmint.com\/install-sysstat-in-linux\/\" target=\"_blank\" rel=\"noopener\">all-in-one system resources statistics generating tool<\/a>, it combines information from several other tools such as vmstat, mpstat, iostat, netstat and ifstat.<\/p>\n<p>I hope this review will be helpful to you, most importantly, you can share with us any suggestions, supplementary ideas to improve the article and also give us feedback about your experience using of\u00a0<strong>dstat<\/strong>through the comment section below.<\/p>\n<p>&nbsp;<br \/>\n<a href=\"https:\/\/www.tecmint.com\/dstat-monitor-linux-server-performance-process-memory-network\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some of the popular and frequently used system resource generating tools available on the Linux platform include\u00a0vmstat,\u00a0netstat,\u00a0iostat,\u00a0ifstat\u00a0and\u00a0mpstat. They are used for reporting statistics from different system components such as virtual memory, network connections and interfaces, CPU, input\/output devices and more. As a system administrator, you may be looking for that one tool that can give &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/14\/dstat-a-resourceful-tool-to-monitor-linux-server-performance-in-real-time\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Dstat \u2013 A Resourceful Tool to Monitor Linux Server Performance in Real-Time&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11533","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11533"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11533\/revisions"}],"predecessor-version":[{"id":11534,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11533\/revisions\/11534"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}