Learn How to use Dstat tool to Monitor Linux Server Performance?

Dstat is a versatile resource statistics tool that combines the functionality of iostat, vmstat, netstat, and ifstat. This powerful command-line utility allows system administrators to monitor server resources in real-time, making it ideal for troubleshooting performance issues and analyzing system behavior.

Features

  • Combines vmstat, iostat, ifstat, netstat functionality and more

  • Shows statistics in the same timeframe for easy correlation

  • Enables ordering counters as they make sense during analysis or troubleshooting

  • Features modular design for flexibility

  • Written in Python, making it easily extendable

  • Supports custom counters and external plugins

  • Can summarize grouped block/network devices and provide total numbers

  • Displays interrupts per device

  • Provides colored output for better readability

Installing Dstat

To install Dstat on Ubuntu/Debian systems, use the following command −

$ sudo apt install dstat

The installation output will show package information and successful setup −

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  dstat
0 upgraded, 1 newly installed, 0 to remove and 284 not upgraded.
Need to get 41.7 kB of archives.
After this operation, 351 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 dstat all 0.7.2-4 [41.7 kB]
Fetched 41.7 kB in 0s (87.5 kB/s)
Selecting previously unselected package dstat.
(Reading database ... 174827 files and directories currently installed.)
Preparing to unpack .../archives/dstat_0.7.2-4_all.deb ...
Unpacking dstat (0.7.2-4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up dstat (0.7.2-4) ...

To view all available options, use the help command −

$ dstat -h

Basic Usage

Running Dstat without any options provides a comprehensive overview of system resources −

$ dstat

This displays real-time statistics including CPU usage, disk I/O, network activity, paging, and system information −

----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
 21   5  68   6   0   0| 14M   90k|   0     0 | 64B 1840B|1108 2264
  3   4  93   0   0   0|   0     0|   0     0 |   0     0| 246  278
  1   1  98   0   0   0|   0     0| 369B  132B|   0     0| 225  280
 12   5  83   0   0   0|   0  100k|1099B 6597B|   0     0| 719 1593

Monitoring Specific Resources

CPU Usage

To monitor only CPU statistics, use the -c flag −

$ dstat -c
----total-cpu-usage----
usr sys idl wai hiq siq
 21   5  68   6   0   0
  3   0  97   0   0   0
  2   1  97   0   0   0
  3   3  93   2   0   0

Memory Usage

To display memory statistics, use the -m flag −

$ dstat -m
------memory-usage-----
 used  buff  cach  free
2249M  89.2M 800M  238M
2248M  89.2M 801M  238M
2249M  89.2M 798M  240M
2248M  89.2M 798M  241M

Network Statistics

To monitor network activity, use the -n flag −

$ dstat -n
-net/total-
 recv  send
    0     0
 120B     0
 360B     0
 120B     0

Advanced Options

Option Description Example
-d Disk statistics dstat -d
-l Load averages dstat -l
-p Process statistics dstat -p
-s Swap usage dstat -s
-t Time/date output dstat -t
--tcp TCP connection stats dstat --tcp
--top-cpu Top CPU consuming processes dstat --top-cpu

Practical Examples

Combine multiple options for comprehensive monitoring −

$ dstat -cmn --top-cpu 5 10

This command displays CPU, memory, network stats, and top CPU processes every 5 seconds for 10 intervals.

Monitor specific network interface −

$ dstat -N eth0,total

Conclusion

Dstat is an essential tool for Linux system administrators, providing real-time insights into system performance. Its ability to combine multiple monitoring functions into one unified interface makes it invaluable for troubleshooting performance issues and understanding system behavior patterns.

Updated on: 2026-03-17T09:01:38+05:30

612 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements