dstat command in Linux w/ examples

-y, –sys
enable system stats (interrupts, context switches)–snmp-cpu
force float values on-screen (mutual exclusive with –integer)–top-io-adv
show most expensive I/O process (incl. pid and other stats)–qmail
show qmail queue sizes (needs qmail)–top-bio
show most expensive block I/O process

dstat options

Hello world example dstat plugin
show dstat advanced memory usage
show process using the most CPU time (in ms)
show VMware memory stats from hypervisor
show load stats using SNMP from DSTAT_SNMPSERVER
show InnoDB operations counters
show OpenVZ user beancounters
-t, –time
enable time/date output
aio, cpu, cpu24, cpu-adv, cpu-use, 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
enable vm stats (hard pagefaults, soft pagefaults, allocated, free)
show redis stats
-c, –cpu
enable CPU stats (system, user, idle, wait), for more CPU related stats also see –cpu-adv and –cpu-use
To use the time plugin together with cpu, net, disk, system, load, proc and top_cpu plugins, use: (see above screenshot)
show NFS v3 client operations
–fs, –filesystem
enable filesystem stats (open files, inodes)
show VMware ESX kernel port stats
enable ipc stats (message queue, semaphores, shared memory)
enable udp stats (listen, active)
show dstat context switches
show network stats using SNMP from DSTAT_SNMPSERVER
Dstat is used for generating system resource statistics. It is a versatile replacement for vmstat, iostat, netstat and ifstat and overcomes some of the limitations of those tools. In addition, it adds some extra features, more counters and flexibility. Dstat is suitable for monitoring systems during performance tuning, benchmarking and troubleshooting.
average size (in sectors) of the requests that were issued to the device
show most expensive CPU process (incl. pid and other stats)
-s, –swap
enable swap stats (used, free)
-d, –disk
enable disk stats (read, write), for more disk related stats look into the other –disk plugins
show innodb I/O stats
show squid usage statistics
show dstat advanced CPU usage
force integer values on-screen (mutual exclusive with –float)
show most expensive block I/O process (incl. pid and other stats)
show most frequent interrupt
show the MySQL I/O stats
This dstat command guide follows my previous 90 Linux Commands frequently used by Linux Sysadmins article. As time allows, I will continue to publish articles on around the 90 commands geared toward Linux sysadmins and Linux power users. Let’s continue this series with the dstat command.
enable zoneinfo stats (d32F, d32H, normF, normH)
battery in percentage (needs ACPI)
-N eth1,total
include eth1 and total (when using -n/–net)
show system stats (interrupts and context switches) using SNMP from DSTAT_SNMPSERVER
enable advanced cpu stats
To use dstat to relate disk-throughput with network-usage (eth0), total CPU-usage and system counters, use:
show RPC client calls stats
enable socket stats (total, tcp, udp, raw, ip-fragments)
enable file lock stats (posix, flock, read, write)
show advanced VMware memory stats from hypervisor
show ZFS l2arc stats
-C 0,3,total
include cpu0, cpu3 and total (when using -c/–cpu); use all to show all CPUs
show ZFS arc stats

dstat plugins

show software raid (md) progress and speed
number of transfers per second that were issued to the device
system temperature sensors
show the number of packets received and transmitted
show extended NFS v4 server operations
show VMware ESX kernel vmhba stats
-S swap1, total
include swap1 and total (when using -s/–swap)
show process with highest total latency (in ms)
-v, –vmstat
equals -pmgdsc -D total
show lustre I/O throughput
-n, –net
enable network stats (receive, send)
-l, –load
enable load average stats (1 min, 5 mins, 15mins)
show CPU usage per OpenVZ guest
average queue length of the requests that were issued to the device
show number of ticks per second
enable tcp stats (listen, established, syn, time_wait, close)
show sendmail queue size (needs sendmail)
enable (external) plugins by plugin name, see PLUGINS for options
per filesystem disk usage
show process with the highest average timeslice (in ms)
show most expensive I/O process
disable intermediate updates when delay > 1
disable colors
-r, –io
enable I/O request stats (read, write requests)
enable only cpu usage stats
show test plugin output
Dstat allows an overview of system resources in real-time. For example, you can compare disk utilization with interrupts or compare network bandwidth numbers directly with storage I/O.
show I/O usage per OpenVZ guest
-f, –full
expand -C, -D, -I, -N and -S discovery lists
show process with the highest average latency (in ms)
show the number of hits and misses from Memcache
show extended NFS v3 client operations
Dstat delivers detailed selective information in columns and indicates the magnitude and units. Less confusion, fewer mistakes. Most notably, it makes it easy to create plugins to collect your counters. 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.
show ZFS zil stats
-D total,hda
include total and hda (when using -d/–disk)
percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device)
show the MySQL keys stats
enable advanced memory stats
show total number of processes
As this series progresses, integrating dstat into your diagnostic toolkit can significantly enhance your ability to maintain and optimize your computing environment efficiently.
show postfix queue sizes (needs postfix)
-I 5,10
include interrupt 5 and 10 (when using -i/–int)
–bw, –blackonwhite
change colors for white background terminal
While anyone can create additional dstat plugins, dstat ships with several default plugins. These are:
enable unix stats (datagram, stream, listen, active)
show extended NFS v3 server operations
-T, –epoch
enable time counter (seconds since epoch)
show NFS v3 server operations
force bits for values expressed in bytes
wireless link quality and signal to noise ratio
show process waiting for child the most
show process that will be killed by OOM the first
-a, –all
equals -cdngy (default)
number of dbus connections (needs python-dbus)
battery remaining in hours, minutes (needs ACPI)
average time (in milliseconds) for I/O requests issued to the device to be served
show innodb buffer stats
show NFS v4 stats
In wrapping up this exploration of the dstat command, it’s clear that its utility extends far beyond simple system monitoring. Dstat offers Linux sysadmins and power users a dynamic and detailed window into their systems’ performance. With its extensive plugin architecture and ability to present complex data in an accessible format, dstat is a critical tool for anyone serious about performance tuning, benchmarking, or troubleshooting Linux systems.
-m, –mem
enable memory stats (used, buffers, cache, free); for more memory-related stats also try –mem-adv and –swap
show CPU stats using SNMP from DSTAT_SNMPSERVER
show profiling statistics when exiting dstat
fan speed (needs ACPI)
show dstat cputime consumption and latency
enable raw stats (raw sockets)
-g, –page
enable page stats (page in, page out)
GPFS filesystem operations (needs mmpmon)
show power usage
show VMware CPU stats from hypervisor
GPFS read/write I/O (needs mmpmon)
show memory stats using SNMP from DSTAT_SNMPSERVER

-p, –proc
enable process stats (runnable, uninterruptible, new)
show VMware ESX kernel interrupt stats
enable aio stats (asynchronous I/O)
list the internal and external plugin names
disable repetitive headers
show RPC server calls stats
show most expensive CPU process
-i, –int
enable interrupt stats
–output file
write CSV output to file
show NTP time from an NTP server
CPU frequency in percentage (needs ACPI)
show network errors using SNMP from DSTAT_SNMPSERVER
average service time (in milliseconds) for I/O requests that were issued to the device

show number of utmp connections (needs python-utmp)–top-mem
show process using the most memory–vm-adv
enable advance vm stats (steal, scanK, scanD, pgoru, astll)

Similar Posts