了解如何使用Dstat工具监视Linux服务器性能?
本文向大家介绍了解如何使用Dstat工具监视Linux服务器性能?,包括了了解如何使用Dstat工具监视Linux服务器性能?的使用技巧和注意事项,需要的朋友参考一下
Dstats是一种多功能的资源统计工具。该仪器结合了iostat,vmstat,netstat和ifstat的功能。Dstats允许我们实时监视服务器资产。当您需要实时收集此专业知识时,Dstat会调整/适合您的要求。本文介绍了有关如何使用Dstat工具监视Linux服务器性能的信息。
特征
它结合了vmstat,iostat,ifstat,netstat专有技术和其他功能
它在完全相同的时间范围内显示统计信息
它具有启用/订购计数器的功能,因为它们在评估/故障排除期间最有意义
它是模块化设计
这是python程序,可以轻松扩展到手头的企业
扩展非常容易,添加您自己的计数器(请贡献这些)
它包括许多外部插件,以显示添加计数器有多么容易
它可以汇总分组的块/网络小工具并给出整数
它显示每个设备的中断
安装Dstats
要安装Dstats,请使用以下命令-
$ sudo apt install dstat
样本输出应该像这样-
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) ...
要获取有关Dstats的更多信息,请使用以下命令-
$ dstat -h
样本输出应如下所示–
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 ...................................................................................
Dstat的用法
要运行Dstat,请使用以下命令–
$ dstat
样本输出应如下所示–
----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使用率
要获取CPU使用率,请使用以下命令,如下所示-
$ dstat -c
样本输出应如下所示–
----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 ............................................
内存使用情况
要获取服务器的内存使用量,请使用以下命令,如下所示–
$ dstat -m
样本输出应如下所示–
------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 ............................................
网络统计
要获取网络统计信息,请使用以下命令,如下所示–
$ dstat -n
样本输出应如下所示–
-net/total- recv send 0 0 120B 0 360B 0 120B 0 0 0 428B 0 304B 0 120B 0 184B 0 194B 65B ....................................................
在本文之后,您将能够了解如何使用Dstat工具来监视Linux服务器性能。在我们的下一篇文章中,我们将提出更多基于Linux的技巧。继续阅读!