Wednesday, May 21, 2014

dstat - A Cool Resource Statistics Tool

dstat is a versatile replacement for vmstat, iostat, netstat and ifstat. It overcomes some of their limitations and adds some extra features. dstat is handy for monitoring systems during performance tuning tests, benchmarks or troubleshooting. One important thing about dstat is that its output by default is designed for being interpreted by human in real-time, but you can also export details to CSV output to a file to be imported later.

For completely manual: dstat manual

Some of dstat features:
Combines vmstat, iostat, ifstat and netstat information.'
Real-time
Written in Python
Show interrupts per device

Existing Plugins:
# dstat --list

internal:

aio, cpu, cpu24, disk, disk24, disk24old, epoch, fs, int, int24, io, ipc, load, lock, mem, net, page, page24, proc, raw, socket, swap, swapold, sys, tcp, time,
udp, unix, vm

/usr/share/dstat:

battery, battery-remain, cpufreq, dbus, disk-util, fan, freespace, gpfs, gpfs-ops, helloworld, innodb-buffer, innodb-io, innodb-ops, lustre, memcache-hits,
mysql-io, mysql-keys, mysql5-cmds, mysql5-conn, mysql5-io, mysql5-keys, net-packets, nfs3, nfs3-ops, nfsd3, nfsd3-ops, ntp, postfix, power, proc-count, rpc, rpcd,
sendmail, snooze, thermal, top-bio, top-cpu, top-cputime, top-cputime-avg, top-io, top-latency, top-latency-avg, top-mem, top-oom, utmp, vm-memctl, vmk-hba,
vmk-int, vmk-nic, vz-cpu, vz-io, vz-ubc, wifi

Sample commands:
Check top CPU, disk i/o and network i/o
# dstat
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw
  8   1  90   1   0   0|  24k   55k|   0     0 |   0     0 | 847  1837
  5   1  94   0   0   0|   0    44k|  60B   95B|   0     0 | 876  2068
  5   1  94   0   0   0|4096B    0 | 981B 2740B|   0     0 | 958  2261

Check top cpu, most expensive process for disk i/o
# dstat -c --top-cpu -d --top-bio --top-latency
----total-cpu-usage---- -most-expensive- -dsk/total- ----most-expensive---- --highest-total--
usr sys idl wai hiq siq|  cpu process   | read  writ|  block i/o process   | latency process
  8   1  90   1   0   0|firefox      0.9|  24k   55k|chrome     3895B   30k|kondemand/0  4381
  5   1  94   0   0   0|firefox      1.5|   0  8192B|chrome        0  4096B|kondemand/1    16
  5   1  94   0   0   0|firefox      1.5|   0     0 |terminator    0  8192B|kondemand/1    17

Check network status:
# stat -f --net --debug
Module dstat_net requires ['/proc/net/dev']
--net/eth0----net/tun0----net/tun1----net/tun2---net/vmnet1--net/vmnet8--net/wlan0-
 recv  send: recv  send: recv  send: recv  send: recv  send: recv  send: recv  send
   0     0 :   0     0 :   0     0 :   0     0 :   0     0 :   0     0 :   0     0   0.32ms
 595B  190B:  68B    0 :  68B    0 :  68B    0 :   0     0 :   0     0 :   0     0   0.66ms
 416B    0 :   0     0 :   0     0 :   0     0 :   0     0 :   0     0 :   0     0   0.88ms
  60B   66B:   0     0 :   0     0 :   0     0 :   0     0 :   0     0 :   0     0   0.55ms

No comments: