
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use dstat Tool to Monitor Linux Server Performance
Dstats is a versatile resource statistic tool. This instrument combines the capability of iostat, vmstat, netstat, and ifstat. Dstats permits us to watch the server assets in real-time. While you need to collect this know-how in actual-time, Dstat will adjust /suit your requirements. This article explains about how to use Dstat tool to Monitor Linux Server Performance.
Features
- It combines vmstat, iostat, ifstat, netstat know-how and extra
- It shows stats in exactly the equal timeframe
- It has the capability to enable/order counters as they make most sense for the period of evaluation/troubleshooting
- It is a modular design
- This is python program so comfortably extendable for the venture at hand
- It is very easy to extend, add your possess counters (please contribute these)
- It includes many outside plugins to show how easy it is to add counters
- It can summarize grouped block/network gadgets and give whole numbers
- It shows interrupts per device
Installing Dstats
To install Dstats, use the following commands−
$ sudo apt install dstat
The sample output should be like this −
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: dstat 0 upgraded, 1 newly installed, 0 to remove and 284 not upgraded. Need to get 41.7 kB of archives. After this operation, 351 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 dstat all 0.7.2-4 [41.7 kB] Fetched 41.7 kB in 0s (87.5 kB/s) Selecting previously unselected package dstat. (Reading database ... 174827 files and directories currently installed.) Preparing to unpack .../archives/dstat_0.7.2-4_all.deb ... Unpacking dstat (0.7.2-4) ... Processing triggers for man-db (2.7.5-1) ... Setting up dstat (0.7.2-4) ...
To get the more information about Dstats, use the following command-
$ dstat -h
The sample output should be like this –
Usage: dstat [-afv] [options..] [delay [count]] Versatile tool for generating system resource statistics Dstat options: -c, --cpu enable cpu stats -C 0,3,total include cpu0, cpu3 and total -d, --disk enable disk stats -D total,hda include hda and total -g, --page enable page stats -i, --int enable interrupt stats -I 5,eth2 include int5 and interrupt used by eth2 -l, --load enable load stats -m, --mem enable memory stats -n, --net enable network stats -N eth1,total include eth1 and total -p, --proc enable process stats -r, --io enable io stats (I/O requests completed) -s, --swap enable swap stats -S swap1,total include swap1 and total -t, --time enable time/date output -T, --epoch enable time counter (seconds since epoch) -y, --sys enable system stats --aio enable aio stats --fs, --filesystem enable fs stats --ipc enable ipc stats --lock enable lock stats --raw enable raw stats --socket enable socket stats --tcp enable tcp stats --udp enable udp stats --unix enable unix stats --vm enable vm stats ...................................................................................
Usage of Dstat
To run Dstat, use the following command –
$ dstat
The sample output should be like this –
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai hiq siq| read writ| recv send| in out | int csw 21 5 68 6 0 0| 14M 90k| 0 0 | 64B 1840B|1108 2264 3 4 93 0 0 0| 0 0 | 0 0 | 0 0 | 246 278 1 1 98 0 0 0| 0 0 | 369B 132B| 0 0 | 225 280 12 5 83 0 0 0| 0 100k|1099B 6597B| 0 0 | 719 1593 30 6 63 1 0 0| 0 24k| 303B 0 | 0 0 |1639 4309 4 2 91 3 0 0| 0 180k| 920B 65B| 0 0 | 728 1105 3 1 96 0 0 0| 0 0 | 126B 66B| 0 0 | 335 467 2 1 97 0 0 0| 0 0 | 60B 0 | 0 0 | 239 303 2 1 98 0 0 0| 0 72k| 568B 0 | 0 0 | 244 283 3 3 95 0 0 0| 0 0 | 304B 0 | 0 0 | 535 790 9 2 89 0 0 0| 0 0 | 60B 0 | 0 0 | 789 1431 14 6 79 2 0 0| 0 52k| 60B 0 | 0 0 |1243 2266 35 8 57 0 0 0| 0 0 | 180B 0 | 0 0 |1351 4002 11 2 87 1 0 0| 0 0 | 180B 0 | 0 0 | 674 1326 11 3 86 0 0 0| 0 0 | 60B 0 | 0 0 | 661 1563 8 2 90 0 0 0| 0 0 | 60B 0 | 0 0 | 625 1278 6 2 92 0 0 0| 0 0 | 120B 0 | 0 0 | 423 825 14 3 82 1 0 0| 0 16k| 180B 0 | 0 0 | 807 1789 18 4 78 0 0 0| 0 0 | 263B 81B| 0 0 |1310 2984 17 4 80 0 0 0| 0 0 | 186B 66B| 0 0 |1047 2489 19 5 77 0 0 0| 0 0 | 970B 1969B| 0 0 |1124 2647 16 7 77 0 0 0| 0 0 | 120B 0 | 0 0 |1146 2532 19 6 75 0 0 0| 0 0 | 120B 0 | 0 0 |1099 2657 ...............................................................................
CPU Usage
To get the CPU usage, use the following command as shown below –
$ dstat -c
The sample output should be like this –
----total-cpu-usage---- usr sys idl wai hiq siq 21 5 68 6 0 0 3 0 97 0 0 0 2 1 97 0 0 0 3 3 93 2 0 0 5 2 93 0 0 0 9 5 86 0 0 0 19 8 71 2 0 0 37 8 54 0 0 0 11 3 86 0 0 0 13 3 83 0 0 0 16 5 78 1 0 0 17 5 77 1 0 0 16 4 80 0 0 0 ............................................
Memory usage
To get the memory usage of server, use the following command as shown below –
$ dstat -m
The sample output should be like this –
------memory-usage----- used buff cach free 2249M 89.2M 800M 238M 2248M 89.2M 801M 238M 2249M 89.2M 798M 240M 2249M 89.2M 798M 240M 2248M 89.2M 798M 241M 2248M 89.2M 798M 241M 2248M 89.2M 798M 241M 2248M 89.2M 798M 241M 2248M 89.3M 798M 241M 2248M 89.3M 798M 241M ............................................
Network Stats
To get the network stats, use the following command as shown below –
$ dstat -n
The sample output should be like this –
-net/total- recv send 0 0 120B 0 360B 0 120B 0 0 0 428B 0 304B 0 120B 0 184B 0 194B 65B ....................................................
After this article, you will be able to understand how to use Dstat tool to Monitor Linux Server Performance. In our next articles, we will come up with more Linux based tricks and tips. Keep reading!