Skip to content

Instantly share code, notes, and snippets.

@rmi1974
Last active March 29, 2020 16:11
Show Gist options
  • Save rmi1974/399acc3992fdb84c13d8ed512fcac902 to your computer and use it in GitHub Desktop.
Save rmi1974/399acc3992fdb84c13d8ed512fcac902 to your computer and use it in GitHub Desktop.
Dstat: Versatile resource statistics tool #debug #performance #commandlinefu

Dstat: Versatile resource statistics tool

Dstat is a versatile replacement for vmstat, iostat, netstat and ifstat. Dstat overcomes some of their limitations and adds some extra features, more counters and flexibility. Dstat is handy for monitoring systems during performance tuning tests, benchmarks or troubleshooting.

Dstat allows you to view all of your system resources in real-time, you can eg. compare disk utilization in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval).

Dstat gives you detailed selective information in columns and clearly indicates in what magnitude and unit the output is displayed. Less confusion, less mistakes. And most importantly, it makes it very easy to write plugins to collect your own counters and extend in ways you never expected.

Dstat's output by default is designed for being interpreted by humans in real-time, however you can export details to CSV output to a file to be imported later into Gnumeric or Excel to generate graphs.

List of plugins:

$ dstat --list

internal:
	aio, cpu, cpu-adv, cpu-use, cpu24, disk, disk24, disk24-old, epoch, fs, int, int24, io, ipc, load, lock, mem, mem-adv, net, page, page24, proc, raw, socket, swap, swap-old, sys, tcp, time, 
	udp, unix, vm, vm-adv, zones
/usr/share/dstat:
	battery, battery-remain, condor-queue, cpufreq, dbus, disk-avgqu, disk-avgrq, disk-svctm, disk-tps, disk-util, disk-wait, dstat, dstat-cpu, dstat-ctxt, dstat-mem, fan, freespace, fuse, gpfs, 
	gpfs-ops, helloworld, innodb-buffer, innodb-io, innodb-ops, lustre, md-status, memcache-hits, mysql-io, mysql-keys, mysql5-cmds, mysql5-conn, mysql5-innodb, mysql5-innodb-basic, 
	mysql5-innodb-extra, mysql5-io, mysql5-keys, net-packets, nfs3, nfs3-ops, nfsd3, nfsd3-ops, nfsd4-ops, nfsstat4, ntp, postfix, power, proc-count, qmail, redis, rpc, rpcd, sendmail, snmp-cpu, 
	snmp-load, snmp-mem, snmp-net, snmp-net-err, snmp-sys, snooze, squid, test, thermal, top-bio, top-bio-adv, top-childwait, top-cpu, top-cpu-adv, top-cputime, top-cputime-avg, top-int, top-io, 
	top-io-adv, top-latency, top-latency-avg, top-mem, top-oom, utmp, vm-cpu, vm-mem, vm-mem-adv, vmk-hba, vmk-int, vmk-nic, vz-cpu, vz-io, vz-ubc, wifi, zfs-arc, zfs-l2arc, zfs-zil

Example usage:

$ dstat -c --top-cpu -d --top-bio --top-latency

--total-cpu-usage-- -most-expensive- -dsk/total- ----most-expensive---- --highest-total--
usr sys idl wai stl|  cpu process   | read  writ|  block i/o process   | latency process 
 38   7  55   1   0|Xorg         1.2|3390k 7234k|xfce4-termi  52k  530k|Xorg           14
 96   4   0   0   0|cross-localed 13| 108k    0 |make        104k  144k|cc1plus       319
 97   3   0   0   0|cross-localed 12|   0     0 |                      |cc1plus       395
 97   3   0   0   0|cross-localed 12|  48k  320k|make         92k  136k|cc1plus       251
 96   4   0   0   0|cross-localed 12|  64k    0 |make        100k  504k|cc1plus       240
 90  10   1   0   0|cross-localed 11| 360k 4104k|cross-local   0  2824k|cc1plus       261
 86  14   0   0   0|cc1plus       11|  84k    0 |lib32-glibc 496k  935M|cc1plus       244
 86  13   1   0   0|cc1plus       12| 104k    0 |tar          84k   99M|tar           513
 83  16   1   0   0|cc1plus       12| 456k 4636k|lib32-glibc 108k  216M|cc1plus       277
 91   9   0   0   0|cc1plus       12|  28k    0 |make         20k   48k|cc1plus       284
 87  13   0   0   0|cc1plus       12| 424k   12M|lib32-glibc 264k    0 |cc1plus       412
 82  17   0   0   0|cc1plus       11| 368k   20k|make        508k 1904k|cc1plus       344
 84  16   0   0   0|cc1plus       10| 196k    0 |make        360k  288k|cc1plus       360
 86  14   0   0   0|cc1plus       12| 460k   22M|make        188k  240k|cc1plus       227
 92   8   0   0   0|cc1plus       12| 300k    0 |cc1plus     232k    0 |lib32-glibc-l 231
 90  10   0   0   0|cc1plus       10| 336k 8548k|make        520k  540k|cc1plus       187
 90  10   0   0   0|cc1plus       12| 252k    0 |make        156k  192k|cc1plus       178
 91   9   0   0   0|cc1plus       12| 236k    0 |make         92k  112k|cc1plus       236
 ...

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment