Dstat
Dstat: Installation & usage guide
What is Dstat?
Dstat is a versatile real-time resource monitoring tool that combines and extends tools like vmstat, iostat, and ifstat. It provides detailed, customizable output on system resources such as CPU, memory, disk, network, interrupts, and more. Output can be written to a CSV file for graphing and analysis.
Installation
CentOS:
yum install dstatUbuntu:
sudo apt-get install dstatCommon options
| Option | Description |
|---|
-c, --cpu | CPU usage (user, system, idle, etc.) |
-C 0,3,total | Specific CPUs |
-d, --disk | Disk read/write stats |
-D total,hda | Specific disks |
-g, --page | Page in/out |
-i, --int | Interrupts |
-I 5,10 | Specific interrupts |
-l, --load | Load average (1, 5, 15 mins) |
-m, --mem | Memory usage |
-n, --net | Network usage |
-N eth1,total | Specific interfaces |
-p, --proc | Process stats |
-r, --io | I/O requests |
-s, --swap | Swap usage |
-S swap1,total | Specific swap devices |
-t, --time | Show time/date |
-T, --epoch | Show epoch timestamp |
-y, --sys | System stats |
Other useful flags:
--output file.csv— Write output to CSV--list— List all available plugins-a— Equivalent to-cdngy-f— Expands device/interface listings--float/--integer— Force output type--nocolor,--noheaders,--noupdate— Format control
Plugins (Sample)
Dstat supports a wide range of optional plugins, including:
--top-cpu,--top-io,--top-mem— Top resource consumers--thermal,--fan,--battery— ACPI sensors--mysql5-*,--innodb-*— MySQL performance--net-packets,--disk-util— Extended network/disk metrics--wifi,--vmk-*,--vz-*— Virtualization stats
Use --list to view all available plugins.
Arguments
delay– Interval between updates (default: 1 second)count– Number of updates before exit (default: unlimited)
If delay > 1, dstat shows intermediate averages unless --noupdate is set.
Example commands
- Monitor disk, network, and CPU stats:
dstat -dnyc -N eth0 -C total -f 5- View system impact with debug:
dstat -taf --debug- Full system overview with top CPU process:
dstat -tcndylp --top-cpuConclusion
Dstat is a versatile command-line tool for real-time system resource monitoring, serving as an enhanced alternative to tools like vmstat, iostat, and ifstat. It allows users to view detailed statistics on CPU, memory, disk I/O, network usage, system interrupts, load averages, and more, all in a customizable and easily readable format. Output can be written to CSV for external analysis or graphing. Installation is simple via yum on CentOS or apt on Ubuntu. Dstat supports a wide range of options and plugins, enabling deep insights into specific system areas, such as MySQL performance, ACPI battery stats, virtual machines, and top resource-consuming processes. Common use cases include correlating disk and network activity, monitoring process behavior, or assessing system load over time with the --time, --cpu, --net, --disk, --sys, and --top-cpu options.