版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tiantao2012/article/details/82595250
dsata的常规用法如下所示表示每3s刷新一次结果,总共输出10次
[root@localhost tomcat]# dstat 3 10
You did not select any stats, using -cdngy by default.
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
0 0 100 0 0 0|2293B 8743B| 0 0 | 0 0 | 101 107
0 0 100 0 0 0| 0 0 | 305B 517B| 0 0 | 142 200
0 0 100 0 0 0| 0 0 | 392B 346B| 0 0 | 119 147 ^C
但是在下面这个目录中有一些写好的dstat的脚步可以利用
[root@localhost tomcat]# cd /usr/share/dstat/
例如dstat_top_cpu.py 这个脚步的用法如下所示:
[root@localhost tomcat]# dstat -g -l -m -s --top-cpu
---paging-- ---load-avg--- ------memory-usage----- ----swap--- -most-expensive-
in out | 1m 5m 15m | used buff cach free| used free| cpu process
0 0 | 0 0 0|5904M 10.4M 3532M 246G| 0 4096M|kworker/6:1-c0.0
0 0 | 0 0 0|5909M 10.4M 3532M 246G| 0 4096M|
0 0 | 0 0 0|5909M 10.4M 3532M 246G| 0 4096M|
0 0 | 0 0 0|5909M 10.4M 3532M 246G| 0 4096M|
0 0 | 0 0 0|5909M 10.4M 3532M 246G| 0 4096M|
0 0 | 0 0 0|5909M 10.4M 3532M 246G| 0 4096M| ^C
[root@localhost tomcat]#
例如
dstat_dstat_cpu.py 的这个脚本实现的子命令如下:
[root@localhost dstat]# dstat --dstat-cpu
--dstat-cpu---
user syst tota
0 0 0
0 0 0
0 0 0^C
[root@localhost dstat]#
常用的有
--disk-util 显示磁盘的使用率
--freespace 磁盘空闲率
--proc-count正在运行的程序数量
--top-bio块IO 最大的进程
--top-cpu cpu占用率最大的进程
--top-io io最大进程
--top-mem 占用内存最多的进程
dstat -g -l -m -s --top-mem
dstat -c -y -l --proc-count --top-cpu