dstat command in Linux w/ examples

-y, –sys
enable system stats (interrupts, context switches)–snmp-cpu
–float
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

–helloworld
Hello world example dstat plugin
–dstat-mem
show dstat advanced memory usage
–top-cputime
show process using the most CPU time (in ms)
–vm-mem
show VMware memory stats from hypervisor
–snmp-load
show load stats using SNMP from DSTAT_SNMPSERVER
–innodb-ops
show InnoDB operations counters
–vz-ubc
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
–vm
enable vm stats (hard pagefaults, soft pagefaults, allocated, free)
–redis
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)
–dbus
–nfs3
show NFS v3 client operations
–fs, –filesystem
enable filesystem stats (open files, inodes)
–vmk-nic
show VMware ESX kernel port stats
–ipc
enable ipc stats (message queue, semaphores, shared memory)
–udp
enable udp stats (listen, active)
–dstat-ctxt
show dstat context switches
–snmp-net
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.
–disk-avgrq
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
–innodb-io
show innodb I/O stats
–squid
show squid usage statistics
–dstat-cpu
show dstat advanced CPU usage
–integer
force integer values on-screen (mutual exclusive with –float)
–top-bio-adv
show most expensive block I/O process (incl. pid and other stats)
–top-int
show most frequent interrupt
–mysql-io
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.
–zones
enable zoneinfo stats (d32F, d32H, normF, normH)
–battery
battery in percentage (needs ACPI)
-N eth1,total
include eth1 and total (when using -n/–net)
–snmp-sys
show system stats (interrupts and context switches) using SNMP from DSTAT_SNMPSERVER
–cpu-adv
enable advanced cpu stats
To use dstat to relate disk-throughput with network-usage (eth0), total CPU-usage and system counters, use:
–rpc
show RPC client calls stats
–socket
enable socket stats (total, tcp, udp, raw, ip-fragments)
–lock
enable file lock stats (posix, flock, read, write)
–vm-mem-adv
show advanced VMware memory stats from hypervisor
–zfs-l2arc
show ZFS l2arc stats
-C 0,3,total
include cpu0, cpu3 and total (when using -c/–cpu); use all to show all CPUs
–zfs-arc
show ZFS arc stats

dstat plugins

–md-status
show software raid (md) progress and speed
–disk-tps
number of transfers per second that were issued to the device
–thermal
system temperature sensors
–net-packets
show the number of packets received and transmitted
–nfsd4-ops
show extended NFS v4 server operations
–vmk-hba
show VMware ESX kernel vmhba stats
-S swap1, total
include swap1 and total (when using -s/–swap)
–top-latency
show process with highest total latency (in ms)
-v, –vmstat
equals -pmgdsc -D total
–lustre
show lustre I/O throughput
-n, –net
enable network stats (receive, send)
-l, –load
enable load average stats (1 min, 5 mins, 15mins)
–vz-cpu
show CPU usage per OpenVZ guest
–disk-avgqu
average queue length of the requests that were issued to the device
–snooze
show number of ticks per second
–tcp
enable tcp stats (listen, established, syn, time_wait, close)
–sendmail
show sendmail queue size (needs sendmail)
–plugin-name
enable (external) plugins by plugin name, see PLUGINS for options
–freespace
per filesystem disk usage
–top-cputime-avg
show process with the highest average timeslice (in ms)
–top-io
show most expensive I/O process
–noupdate
disable intermediate updates when delay > 1
–nocolor
disable colors
-r, –io
enable I/O request stats (read, write requests)
–cpu-use
enable only cpu usage stats
–test
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.
–vz-io
show I/O usage per OpenVZ guest
-f, –full
expand -C, -D, -I, -N and -S discovery lists
–top-latency-avg
show process with the highest average latency (in ms)
–memcache-hits
show the number of hits and misses from Memcache
–nfs3-ops
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.
–zfs-zil
show ZFS zil stats
-D total,hda
include total and hda (when using -d/–disk)
–disk-util
percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device)
–mysql-keys
show the MySQL keys stats
–mem-adv
enable advanced memory stats
–proc-count
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.
–postfix
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:
–unix
enable unix stats (datagram, stream, listen, active)
–nfsd3-ops
show extended NFS v3 server operations
-T, –epoch
enable time counter (seconds since epoch)
–nfsd3
show NFS v3 server operations
–bits
force bits for values expressed in bytes
–wifi
wireless link quality and signal to noise ratio
–top-childwait
show process waiting for child the most
–top-oom
show process that will be killed by OOM the first
-a, –all
equals -cdngy (default)
number of dbus connections (needs python-dbus)
–battery-remain
battery remaining in hours, minutes (needs ACPI)
–disk-wait
average time (in milliseconds) for I/O requests issued to the device to be served
–innodb-buffer
show innodb buffer stats
–nfsstat4
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
–profile
show profiling statistics when exiting dstat
–fan
fan speed (needs ACPI)
–dstat
show dstat cputime consumption and latency
–raw
enable raw stats (raw sockets)
-g, –page
enable page stats (page in, page out)
–gpfs-ops
GPFS filesystem operations (needs mmpmon)
–power
show power usage
–vm-cpu
show VMware CPU stats from hypervisor
–gpfs
GPFS read/write I/O (needs mmpmon)
–snmp-mem
show memory stats using SNMP from DSTAT_SNMPSERVER
–top-cpu-adv

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

–utmp
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