Mastering dstat: Real‑Time Linux System Monitoring Made Easy
This guide explains how to install, configure, and use the dstat command on Linux to monitor CPU, disk, network, memory, and system metrics in real time, including syntax, common options, example outputs, CSV export, and plugin extensions.
dstat is a versatile system‑information tool that replaces utilities such as vmstat, iostat, netstat, nfsstat, and ifstat, offering colored, real‑time output that refreshes every second.
Installation
Two common methods:
Using the package manager: yum install -y dstat Downloading the RPM from the official site and installing it:
wget http://dag.wieers.com/rpm/packages/dstat/dstat-0.6.7-1.rh7.rf.noarch.rpm && rpm -ivh dstat-0.6.7-1.rh7.rf.noarch.rpmBasic Usage
After installation, run dstat. The default option set -cdngy displays CPU, disk, network, paging, and system information, updating every second. You can specify an interval and count, e.g., dstat 5 for a 5‑second interval or dstat 5 10 for 10 reports at that interval.
Example Output
[root@iZ23uulau1tZ ~]# dstat
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
0 0 99 0 0 0|7706B 164k| 0 0 | 0 0 | 189 225
0 0 100 0 0 0| 0 0 |4436B 826B| 0 0 | 195 248
...Key fields: cpu hiq and siq represent hardware and software interrupt counts; system int and csw are interrupt and context‑switch counts.
Syntax
General form:
dstat [-afv] [options...] [delay [count]]Common Options
-c: CPU usage (user, system, idle, wait, hardware and software interrupts). -C: Select specific CPUs, e.g., -C 0,1. -d: Disk read/write statistics. -D hda,total: Include specific disks. -n: Network statistics. -N eth1,total: Choose network interfaces. -l: System load average. -m: Memory usage. -g: Page usage. -p: Process statistics. -s: Swap usage. -r: I/O request statistics. -y: General system status. --ipc: IPC queues and signals. --socket: TCP/UDP socket status. -a: Alias for -cdngy (default set). -v: Verbose mode, equivalent to -pmgdsc -D total. --output FILE: Write results in CSV format to FILE, e.g., dstat --output /root/dstat.csv &.
Advanced Usage Example
Monitor swap, processes, sockets, and filesystem with timestamps: dstat -tsp --socket --fs Sample output shows date/time, swap used/free, process counts, socket statistics, and filesystem usage.
To save the monitoring data to a CSV file: dstat -tsp --socket --fs --output /tmp/ds.csv The generated CSV can be opened in Excel for charting.
Use dstat --list to display all built‑in parameters and available plugins. Built‑in parameters are listed under “internal”, while plugins reside in /usr/share/dstat and extend functionality (e.g., battery, MySQL, etc.), though some plugins require additional packages.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
