dstat is one of the powerful utility in the Linux environment, using it we can get many kinds of performance related statistics to analyse the system performance.
- It is versatile tool for generating system resource statistics.
- It comes from “dstat-0.7.0” package, we have covered almost all the aspects of dstat, knowing is a must for Linux admins.
- Path: /usr/bin/dstat
Examples:
1. To get the system resource statistics
# dstat
# dstat 2 10
—-total-cpu-usage—- -dsk/total- -net/total- —paging– —system– usr sys idl wai hiq siq| read writ | recv send | in out | int csw 1 5 94 0 0 1 | 90k 4655B| 0 0 | 18k 0 | 78 48 0 1 97 0 1 1 | 0 0 | 60B 932B | 0 0 | 18 15 |
- To enable the CPU stats
# dstat -c # dstat –cpu # dstat –cpu 2 10 |
2. To include specified CPUs
# dstat -C 0,1,2,3 |
3. To include and device and total
# dstat -D total,sda # dstat -D total,sda 2 10 |
4. To enable interrupt stats
# dstat -i # dstat –int # dstat -i 2 10 |
5. To include the specified interrupts
# dstat -I 5,10 # dstat -I 5,10 2 10 |
6. To enable load average stats
# dstat -l # dstat –load # dstat -l 2 10 |
7. To enable memory stats
# dstat -m # dstat –mem # dstat -m 2 10 |
8. To enable network stats
# dstat -n # dstat –net # dstat -n 2 10 |
9. To include the particular interfaces
# dstat -N eth0,total # dstat -N eth0,total 2 10 |
10. To enable process stats
# dstat -p # dstat –proc # dstat -p 2 10 |
11. To enable IO requests stats
# dstat -r # dstat –io # dstat -r 2 10 |
12. To enable swap stats
# dstat -s # dstat –swap # dstat -s 2 10 |
13. To include particular swap file
# dstat -S swap1,total # dstat -S swap1,total 2 10 |
14. To enable date and time output
# dstat -t # dstat –time # dstat -t 2 10 |
15. To enable time counter
# dstat -T # dstat –epoch # dstat -T 2 10 |
16. To enable system stats
# dstat -y # dstat –sys # dstat -y 2 10 |
17. To enable aio stats
# dstat –aio # dstat –aio 2 10 |
18. To enable filesystem stats
# dstat –fs # dstat –fs 2 10 |
19. To enable ipc stats (message queue, semaphores, shared memory)
# dstat –ipc # dstat –ipc 2 10 |
20. To enable file lock stats (posix, flock, read, write)
# dstat –lock # dstat –lock 2 10 |
21. To enable raw stats (raw sockets)
# dstat –raw # dstat –raw 2 10 |
22. To enable socket stats (total, tcp, udp, raw, ip-fragments)
# dstat –socket # dstat –socket 2 10 |
23. To enable tcp stats (listen, established, syn, time_wait, close)
# dstat –tcp # dstat –tcp 2 10 |
24. To enable udp stats (listen, active)
# dstat –udp # dstat –udp 2 10 |
25. To enable unix stats (datagram, stream, listen, active)
# dstat –unix # dstat –unix 2 10 |
26. To enable vm stats (hard pagefaults, soft pagefaults, allocated, free)
# dstat –vm # dstat –vm 2 10 |
27. To enable all stats
# dstat -a # dstat –all # dstat -a 2 10 |
28. To enable full stats
# dstat -f # dstat –full # dstat -f 2 10 |
29. To enable vmstat stats
# dstat -v # dstat –vmstat # dstat -v 2 10 |
30. To change colors for white background terminal
# dstat –bw # dstat –blackonwhite # dstat –bw 2 10 |
31. To force float values on screen
# dstat –float # dstat –float 2 10 |
32. To force integer values on screen
# dstat –integer # dstat –integer 2 10 |
33. To disable colors (implies –noupdate)
# dstat –nocolor # dstat –nocolor 2 10 |
34 To disable repetitive headers
# dstat –noheaders # dstat –noheaders 2 10 |
35 To disable intermediate updates when delay > 1
# dstat –noupdate # dstat –noupdate 2 10 |
36. 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
37. To battery in percentage (needs ACPI)
# dstat –battery # dstat –battery 2 10 |
38. To battery remaining in hours, minutes (needs ACPI)
# dstat –battery-remain # dstat –battery-remain 2 10 |
39. To CPU frequency in percentage (needs ACPI)
# dstat –cpufreq # dstat –cpufreq 2 10 |
40. To number of dbus connections (needs python-dbus)
# dstat –dbus # dstat –dbus 2 10 |
41. To per disk utilization in percentage
# dstat –disk-util # dstat –disk-util 2 10 |
42. To fan speed (needs ACPI)
# dstat –fan # dstat –fan 2 10 |
43. To per filesystem disk usage
# dstat –freespace # dstat –freespace 2 10 |
44. To GPFS read/write I/O (needs mmpmon)
# dstat –gpfs # dstat –gpfs 2 10 |
45. To GPFS filesystem operations (needs mmpmon)
# dstat –gpfs-ops # dstat –gpfs-ops 2 10 |
46. To Hello world example dstat plugin
# dstat –helloworld # dstat –helloworld 2 10 |
47. To show innodb buffer stats
# dstat –innodb-buffer # dstat –innodb-buffer 2 10 |
48. To show innodb I/O stats
# dstat –innodb-io # dstat –innodb-io 2 10 |
49. To show innodb operations counters
# dstat –innodb-ops # dstat –innodb-ops 2 10 |
50. To show lustre I/O throughput
# dstat –lustre # dstat –lustre 2 10 |
51. To show the number of hits and misses from memcache
# dstat –memcache-hits # dstat –memcache-hits 2 10 |
52. To show the MySQL5 command stats
# dstat –mysql5-cmds # dstat –mysql5-cmds 2 10 |
53. To show the MySQL5 connection stats
# dstat –mysql5-conn # dstat –mysql5-conn 2 10 |
54. To show the MySQL5 I/O stats
# dstat –mysql5-io # dstat –mysql5-io 2 10 |
55. To show the MySQL5 keys stats
# dstat –mysql5-keys # dstat –mysql5-keys 2 10 |
56. To show the MySQL I/O stats
# dstat –mysql-io # dstat –mysql-io 2 10 |
57. To show the MySQL keys stats
# dstat –mysql-keys # dstat –mysql-keys 2 10 |
58. To show the number of packets received and transmitted
# dstat –net-packets # dstat –net-packets 2 10 |
59. To show NFS v3 client operations
# dstat –nfs3 # dstat –nfs3 2 10 |
60. To show extended NFS v3 client operations
# dstat –nfs3-ops # dstat –nfs3-ops 2 10 |
62. To show NFS v3 server operations
# dstat –nfsd3 # dstat –nfsd3 2 10 |
63 To show extended NFS v3 server operations
# dstat –nfsd3-ops # dstat –nfsd3-ops 2 10 |
64. To show NTP time from an NTP server
# dstat –ntp # dstat –ntp 2 10 |
65. To show postfix queue sizes (needs postfix)
# dstat –postfix # dstat –postfix 2 10 |
66. To show power usage
# dstat –power # dstat –power 2 10 |
67. To show total number of processes
# dstat –proc-count # dstat –proc-count 2 10 |
68. To show RPC client calls stats
# dstat –rpc # dstat –rpc 2 10 |
69. To show RPC server calls stats
# dstat –rpcd # dstat –rpcd 2 10 |
70. To show sendmail queue size (needs sendmail)
# dstat –sendmail # dstat –sendmail 2 10 |
71. To show number of ticks per second
# dstat –snooze # dstat –snooze 2 10 |
72. To show test plugin output
# dstat –test # dstat –test 2 10 |
73. To system temperature sensors
# dstat –thermal # dstat –thermal 2 10 |
74. To show most expensive block I/O process
# dstat –top-bio # dstat –top-bio 2 10 |
75. To show most expensive CPU process
# dstat –top-cpu # dstat –top-cpu 2 10 |
76. To show process using the most CPU time (in ms)
# dstat –top-cputime # dstat –top-cputime 2 10 |
77. To show process with the highest average timeslice (in ms)
# dstat –top-cputime-avg # dstat –top-cputime-avg 2 10 |
78. To show most expensive I/O process
# dstat –top-io # dstat –top-io 2 10 |
79. To show process with highest total latency (in ms)
# dstat –top-latency # dstat –top-latency 2 10 |
80. To show process with the highest average latency (in ms)
# dstat –top-latency-avg # dstat –top-latency-avg 2 10 |
81. To show process using the most memory
# dstat –top-mem # dstat –top-mem 2 10 |
82. To show process that will be killed by OOM the first
# dstat –top-oom # dstat –top-oom 2 10 |
83. To show number of utmp connections (needs python-utmp)
# dstat –utmp # dstat –utmp 2 10 |
84. To show VMware ESX kernel vmhba stats
# dstat –vmk-hba # dstat –vmk-hba 2 10 |
85. To show VMware ESX kernel interrupt stats
# dstat –vmk-int # dstat –vmk-int 2 10 |
86. To show VMware ESX kernel port stats
# dstat –vmk-nic # dstat –vmk-nic 2 10 |
87. To show ballooning status inside VMware guests
# dstat –vm-memctl # dstat –vm-memctl 2 10 |
88. To show CPU usage per OpenVZ guest
# dstat –vz-io # dstat –vz-io 2 10 |
89. To show OpenVZ user beancounters
# dstat –vz-ubc # dstat –vz-ubc 2 10 |
90 To wireless link quality and signal to noise ratio
# dstat –wifi # dstat –wifi 2 10 |