dstat Command Examples in Linux

The dstat application is not commonly installed. It will need to be installed with your package manager. It requires Python 2.2 and above, which is installed by default on modern Linux systems:

# apt-get install dstat
# yum install dstat

The dstat application displays disk, network, memory usage, and running task information at regular intervals. The default output gives you an overview of the system activity. By default, this report is updated every second on a new line, allowing easy comparison with previous values.

The default output lets you track overall system activity. The application supports more options to track top resource users.

dlstat Command Examples

1. Invoking dstat with no arguments will show CPU activity, disk I/O, network I/O, paging, interrupts, and context switches at one second intervals.

The following example shows the default dstat output:

# dstat
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw 
  1   2  97   0   0   0|5457B   55k|   0     0 |   0     0 |1702  3177 
  1   2  97   0   0   0|   0     0 |  15k 2580B|   0     0 |2166  4830 
  1   2  96   0   0   0|   0    36k|1970B 1015B|   0     0 |2122  4794

You can ignore the first line. Those values are the initial contents of the tables dstat mines. The subsequent lines show the activity during a time slice.

# dstat 2 10

2. To enable the CPU stats:

# dstat -c
# dstat --cpu 
# dstat --cpu 2 10
----total-cpu-usage----
usr sys idl wai hiq siq
  1   4  94   0   0   1
  0   0  99   0   0   1

3. To include specified CPUs:

# dstat -C 0,1,2,3

5. To include and device and total:

# dstat -D total,sda 
# dstat -D total,sda 2 10

6. To enable interrupt stats:

# dstat -i
# dstat --int 
# dstat -i 2 10

7. To include the specified interrupts:

# dstat -I 5,10 
# dstat -I 5,10 2 10

8. To enable load average stats:

# dstat -l
# dstat --load 
# dstat -l 2 10

9. To enable memory stats:

# dstat -m
# dstat --mem 
# dstat -m 2 10

10. To enable network stats:

# dstat -n
# dstat --net 
# dstat -n 2 10

11. To include the particular interfaces:

# dstat -N eth0,total 
# dstat -N eth0,total 2 10

12. To enable process stats:

# dstat -p
# dstat --proc 
# dstat -p 2 10

13. To enable IO requests stats:

# dstat -r
# dstat --io 
# dstat -r 2 10

14. To enable swap stats:

# dstat -s
# dstat --swap 
# dstat -s 2 10

15. To include particular swap file:

# dstat -S swap1,total 
# dstat -S swap1,total 2 10

16. To enable date and time output:

# dstat -t
# dstat --time 
# dstat -t 2 10

17. To enable time counter:

# dstat -T
# dstat --epoch 
# dstat -T 2 10

18. To enable system stats:

# dstat -y
# dstat --sys 
# dstat -y 2 10

19. To enable aio stats:

# dstat --aio 
# dstat --aio 2 10

20. To enable filesystem stats:

# dstat --fs 
# dstat --fs 2 10

21. To enable ipc stats (message queue, semaphores, shared memory):

# dstat --ipc 
# dstat --ipc 2 10

22. To enable file lock stats (posix, flock, read, write):

# dstat --lock 
# dstat --lock 2 10

23. To enable raw stats (raw sockets):

# dstat --raw 
# dstat --raw 2 10

24. To enable socket stats (total, tcp, udp, raw, ip-fragments):

# dstat --socket 
# dstat --socket 2 10

25. To enable tcp stats (listen, established, syn, time_wait, close):

# dstat --tcp 
# dstat --tcp 2 10

26. To enable udp stats (listen, active):

# dstat --udp 
# dstat --udp 2 10

27. To enable unix stats (datagram, stream, listen, active):

# dstat --unix 
# dstat --unix 2 10

29. To enable vm stats (hard pagefaults, soft pagefaults, allocated, free):

# dstat --vm 
# dstat --vm 2 10

30. To enable all stats:

# dstat -a
# dstat --all 
# dstat -a 2 10

31. To enable full stats:

# dstat -f
# dstat --full 
# dstat -f 2 10

32. To enable vmstat stats:

# dstats -v
# dstats --vmstat
# dstats -v 2 10

33. To change colors for white background terminal:

# dstat --bw
# dstat --blackonwhite 
# dstat --bw 2 10

34. To force float values on screen:

# dstat --float 
# dstat --float 2 10

35. To force integer values on screen:

# dstat --integer 
# dstat --integer 2 10

36. To disable colors (implies –noupdate):

# dstat --nocolor 
# dstat --nocolor 2 10

37. To disable repetitive headers:

# dstat --noheaders 
# dstat --noheaders 2 10

38. To disable intermediate updates when delay > 1:

# dstat --noupdate 
# dstat --noupdate 2 10

39. To write CSV output to file:

# dstat --output file 
# dstat --output file 2 10

dstat ships with a number of plugins already that extend its capabilities greatly.

40. To battery in percentage (needs ACPI):

# dstat --battery 
# dstat --battery 2 10

41. To battery remaining in hours, minutes (needs ACPI):

# dstat --battery-remain 
# dstat --battery-remain 2 10

42. To CPU frequency in percentage (needs ACPI):

# dstat --cpufreq 
# dstat --cpufreq 2 10

43. To number of dbus connections (needs python-dbus):

# dstat --dbus 
# dstat --dbus 2 10

44. To per disk utilization in percentage:

# dstat --disk-util 
# dstat --disk-util 2 10

45. To fan speed (needs ACPI):

# dstat --fan 
# dstat --fan 2 10

46. To per filesystem disk usage:

# dstat --freespace 
# dstat --freespace 2 10

47. To GPFS read/write I/O (needs mmpmon):

# dstat --gpfs 
# dstat --gpfs 2 10

48. To GPFS filesystem operations (needs mmpmon):

# dstat --gpfs-ops 
# dstat --gpfs-ops 2 10

49. To Hello world example dstat plugin:

# dstat --helloworld 
# dstat --helloworld 2 10

50. To show innodb buffer stats:

# dstat --innodb-buffer 
# dstat --innodb-buffer 2 10

51. To show innodb I/O stats:

# dstat --innodb-io 
# dstat --innodb-io 2 10

52. To show innodb operations counters:

# dstat --innodb-ops 
# dstat --innodb-ops 2 10

53. To show lustre I/O throughput:

# dstat --lustre 
# dstat --lustre 2 10

54. To show the number of hits and misses from memcache:

# dstat --memcache-hits 
# dstat --memcache-hits 2 10

55. To show the MySQL5 command stats:

# dstat --mysql5-cmds 
# dstat --mysql5-cmds 2 10

56. To show the MySQL5 connection stats:

# dstat --mysql5-conn 
# dstat --mysql5-conn 2 10

57. To show the MySQL5 I/O stats:

# dstat --mysql5-io 
# dstat --mysql5-io 2 10

58. To show the MySQL5 keys stats:

# dstat --mysql5-keys 
# dstat --mysql5-keys 2 10

59. To show the MySQL I/O stats:

# dstat --mysql-io 
# dstat --mysql-io 2 10

60. To show the MySQL keys stats:

# dstat --mysql-keys 
# dstat --mysql-keys 2 10

61. To show the number of packets received and transmitted:

# dstat --net-packets 
# dstat --net-packets 2 10

62. To show NFS v3 client operations:

# dstat --nfs3 
# dstat --nfs3 2 10

63. To show extended NFS v3 client operations:

# dstat --nfs3-ops 
# dstat --nfs3-ops 2 10

64. To show NFS v3 server operations:

# dstat --nfsd3 
# dstat --nfsd3 2 10

65. To show extended NFS v3 server operations:

# dstat --nfsd3-ops 
# dstat --nfsd3-ops 2 10

66. To show NTP time from an NTP server:

# dstat --ntp 
# dstat --ntp 2 10

67. To show postfix queue sizes (needs postfix):

# dstat --postfix 
# dstat --postfix 2 10

68. To show power usage:

# dstat --power 
# dstat --power 2 10

69. To show total number of processes:

# dstat --proc-count 
# dstat --proc-count 2 10

70. To show RPC client calls stats:

# dstat --rpc 
# dstat --rpc 2 10

71. To show RPC server calls stats:

# dstat --rpcd 
# dstat --rpcd 2 10

72. To show sendmail queue size (needs sendmail):

# dstat --sendmail 
# dstat --sendmail 2 10

73. To show number of ticks per second:

# dstat --snooze 
# dstat --snooze 2 10

74. To show test plugin output:

# dstat --test 
# dstat --test 2 10

75. To system temperature sensors:

# dstat --thermal 
# dstat --thermal 2 10

76. To show most expensive block I/O process:

# dstat --top-bio 
# dstat --top-bio 2 10

77. To show most expensive CPU process:

# dstat --top-cpu 
# dstat --top-cpu 2 10

78. To show process using the most CPU time (in ms):

# dstat --top-cputime 
# dstat --top-cputime 2 10

79. To show process with the highest average timeslice (in ms):

# dstat --top-cputime-avg 
# dstat --top-cputime-avg 2 10

80. To show most expensive I/O process:

# dstat --top-io 
# dstat --top-io 2 10

81. To show process with highest total latency (in ms):

# dstat --top-latency 
# dstat --top-latency 2 10

82. To show process with the highest average latency (in ms):

# dstat --top-latency-avg 
# dstat --top-latency-avg 2 10

83. To show process using the most memory:

# dstat --top-mem 
# dstat --top-mem 2 10

84. To show process that will be killed by OOM the first:

# dstat --top-oom 
# dstat --top-oom 2 10

85. To show number of utmp connections (needs python-utmp):

# dstat --utmp 
# dstat --utmp 2 10

86. To show VMware ESX kernel vmhba stats:

# dstat --vmk-hba 
# dstat --vmk-hba 2 10

87. To show VMware ESX kernel interrupt stats:

# dstat --vmk-int 
# dstat --vmk-int 2 10

88. To show VMware ESX kernel port stats:

# dstat --vmk-nic 
# dstat --vmk-nic 2 10

89. To show ballooning status inside VMware guests:

# dstat --vm-memctl 
# dstat --vm-memctl 2 10

90. To show CPU usage per OpenVZ guest:

# dstat --vz-io 
# dstat --vz-io 2 10

91. To show OpenVZ user beancounters:

# dstat --vz-ubc 
# dstat --vz-ubc 2 10

92. To wireless link quality and signal to noise ratio:

# dstat --wifi 
# dstat --wifi 2 10
Related Post