Skip to content

Basic usage of dstat

homepage-banner

Get io if vm output in one command.

Introduction

System monitoring is a critical task for any system administrator, and Linux provides a variety of tools to help in this regard. One such tool is dstat - a versatile tool for monitoring system performance in real-time. dstat provides a wealth of information about the system’s CPU, memory, disk I/O, network, and other performance metrics. In this blog post, we will explore the usage of dstat in Linux.

Installation

To use dstat, you must first install it on your Linux system. Fortunately, it is available in most Linux distributions’ default repositories, and you can install it using your distribution’s package manager. For example, in Ubuntu, you can use the apt package manager to install it by running the following command in your terminal:

sudo apt-get install dstat

Usage

dstat -cdlmnpsy
dstat --top-mem --top-cpu --top-io
----total-usage---- -dsk/total- ---load-avg--- ------memory-usage----- -net/total- ---procs--- ----swap--- ---system--
usr sys idl wai stl| read  writ| 1m   5m  15m | used  free  buf   cach| recv  send|run blk new| used  free| int   csw
                   |           |2.01 0.94 0.74| 201M  149M   88M  321M|           |2.0   0    |   0     0 |
 11   6  78   0  11|   0    20k|1.97 0.94 0.74| 202M  149M   88M  321M|  82k  509 |1.5   0 1.0|   0     0 |1481  2400
  8   5  82   0   5|   0    20k|1.93 0.94 0.74| 202M  149M   88M  321M|  88k  299 |1.0   0 1.0|   0     0 |1546  2626
 20   6  52   1  38|   0   250k|1.93 0.94 0.74| 202M  149M   88M  321M| 103k  287 |2.0   0 1.0|   0     0 |1683  2071
 24   6  36   0  60|   0    20k|1.93 0.94 0.74| 202M  149M   88M  321M|  93k  321 |3.0   0 1.0|   0     0 |1382  1262
  8   5  80   0  10|   0    21k|1.93 0.94 0.74| 202M  149M   88M  321M|  68k  294 |1.0   0 1.0|   0     0 |1113  1811
 11   5  77   0  16|   0    20k|1.77 0.93 0.73| 202M  149M   88M  321M|  68k  298 |  0   0 1.0|   0     0 |1161  1796
  7   6  84   0  11|   0    20k|1.77 0.93 0.73| 202M  149M   88M  321M|  86k  286 |1.0   0 1.0|   0     0 |1270  2140
  8   6  79   0   9|   0    64k|1.77 0.93 0.73| 202M  149M   88M  321M|  85k  296 |1.0   0 1.0|   0     0 |1544  2618
  9   8  80   0   6|   0    20k|1.77 0.93 0.73| 202M  149M   88M  321M|  92k  576 |1.0   0 1.0|   0     0 |1709  2971

Metrics

dstat provides a wide range of metrics for monitoring system performance. Here are some of the most commonly used options:

  • c CPU usage
  • d Disk I/O
  • g Page statistics
  • i Network statistics
  • l System load
  • m Memory usage
  • n Network traffic
  • p Process statistics
  • r Memory page rates
  • s Swap space usage
  • t Time/date
  • y System statistics

Conclusion

dstat is a powerful and versatile tool for monitoring system performance in Linux. It provides a wealth of information about the system’s CPU, memory, disk I/O, network, and other performance metrics. By using dstat, you can quickly identify performance bottlenecks and troubleshoot system issues. With the information provided in this blog post, you should be able to start using dstat to monitor your Linux system effectively.

Feedback







Disclaimer
  • Welcome to visit the knowledge base of SRE and DevOps!
  • License under CC BY-NC 4.0
  • Made with Material for MkDocs and improve writing by generative AI tools
  • Copyright issue feedback me#imzye.com, replace # with @