一聚教程网:一个值得你收藏的教程网站

热门教程

Linux的系统监控工具dstat常见用法总结

时间:2022-06-30 16:16:44 编辑:袖梨 来源:一聚教程网

1) 工具说明
dstat是一个用来替换 vmstat,iostat  netstat,nfsstat和ifstat这些命令的工具, 是一个全能系统信息统计工具. 与sysstat相比,  dstat拥有一个彩色的界面, 在手动观察性能状况时, 数据比较显眼容易观察; 而且dstat支持即时刷新, 譬如输入dstat 3,  即每三秒收集一次, 但最新的数据都会每秒刷新显示. 和sysstat相同的是, dstat也可以收集指定的性能资源。

2) 软件安装

代码如下:
# cd /tmp
# rz
# rpm -Uvh dstat-0.6.7-1.el*.rf.noarch.rpm
# which dstat
/usr/bin/dstat
或者Ubuntu(Debian系)下:

代码如下:
$ apt-get install dstat
3) dstat 选项

-C 0,3,total include cpu0, cpu3 and total
-d, -disk 显示磁盘情况
-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 显示内存情况
-n, -net 显示网络情况
-N eth1,total 可以指定网络接口
-p, -proc enable process stats
-s, -swap 显示swap情况
-S swap1,total 可以指定多个swap
-t, -time enable time counter
-y, -sys enable system stats
-ipc 报告IPC消息队列和信号量的使用情况
-lock enable lock stats
-raw enable raw stats
-tcp enable tcp stats
-udp enable udp stats
-unix enable unix stats
-M stat1,stat2 enable external stats
-mods stat1,stat2
-a, -all 使用-cdngy 缺省的就是这样显示
-f, -full 使用 -C, -D, -I, -N and -S 显示
-v, -vmstat 使用-pmgdsc -D 显示
-integer show integer values
-nocolor disable colors (implies -noupdate)
-noheaders 只显示一次表头以后就不显示了,使用重定向写入文件时很有用
-noupdate disable intermediate updates
-output file 写入到CVS文件中
这个软件和vmstat很像,  不过和vmstat相比好像少了io部份的显示, dstat只能显示磁盘的吞吐量而不是显示负载情况, dstat和几乎所有监控软件一样,  只能对整个系统进行监控而不能对某一个进程或某一个程序进行深入分析. 我常使用的参数是dstat -cdlmnpsy, 做个别名链接alias  dstat='dstat -cdlmnpsy'

4)常见用法
查看有关 cpu,硬盘和网络的详细信息。

代码如下:
$dstat

20151030104405498.png (687×324)

查看有关 cpu,硬盘和网络的详细信息。

-c cpu

代码如下:
$ dstat -c

20151030104522344.png (346×240)

-d 磁盘

代码如下:
$ dstat -d

20151030104618695.png (252×222)

显示 cpu、磁盘等的详细信息。

代码如下:

$ dstat -cdl -D sda1

20151030104637015.png (486×412)

热门栏目