How to Monitor Processor, Memory, Network Performance using dstat in Linux?
Do you want to run a quick performance test on your Linux machine? You may want to check the dstat command. Dstat is a versatile and efficient command that combines the features of several older tools such as vmstat, netstat, iostat, and ifstat to provide useful insights into Linux system performance.
You can analyze virtual memory, network connections and interfaces, CPU operation, input/output devices, and more with just one command. We’ll look at some dstat commands and see what they can teach you about your systems in today’s article.
- It shows the information on the complete package from vmstat, iostat, ifstat, netstat, and other sources.
- During analysis/troubleshooting, enable/order counters as they make the most sense.
- Add your own counters to make it more versatile (please contribute those)
- Many external plugins are included to illustrate how simple it is to add counters.
- Can total the numbers from a group of block/network devices.
- When the device is overloaded, the timeframes are extremely precise, and there are no timeshifts.
On most Linux distributions, you can install dstat from the default repositories.
$ sudo apt-get install dstat
Simply run dstat without any options after it has been successfully installed, and you will see something similar to the screen below.
The output above is a result of a cdngy combination:
- c : CPU : Total cpu usage
- d : Disk : Disk Utilization
- n : Net : Total Network usage
- g : Page : page stats
- y : Sys : system stats
Display time-related details about the CPU, memory, eth0 activity:
$ dstat --cpu --mem --net
This command keeps a record of a single program that uses the most CPU and consumes the most memory:
$ dstat -c --top-cpu -dn --top-mem
The output of Dstat is not intended to be used as an input for other instruments. Dstat is designed to make it as simple as possible for humans to view real-time data. This article does not include all of dstat’s capabilities. Since dstat has so many features, you can read its manual page by typing man dstat or dstat -h to see all of dstat’s choices.