" 目录:RHCA+ -> 12 系统监控 -> 9 dstat命令(监控系统资源) "

查看CPU、网络、磁盘等监控信息;语法格式:dstat 参数
|------------|--------------|
| 参数 | 作用 |
| --help | 查看帮助 |
| -c, --cpu | 只查看CPU统计信息 |
| -d, --disk | 只查看磁盘统计信息 |
| -m, --mem | 只查看内存统计信息 |
| -n, --net | 只查看网络统计信息 |
| --tcp | 只查看TCP状态统计信息 |
| --top-cpu | 查看占用CPU最高的进程 |
| --top-mem | 查看占用内存最高的进程 |
| --top-io | 查看占用IO最高的进程 |
一、安装
root@wuzuniao \~# yum -y install dstat #安装软件包
二、使用
root@wuzuniao \~# dstat #查看系统监控
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 99 0 0 0| 47k 3615B| 0 0 | 0 0 | 37 64
0 0 100 0 0 0| 0 0 | 180B 886B| 0 0 | 33 42
1 0 99 0 0 0| 0 0 | 300B 444B| 0 0 | 56 81 ^C
root@wuzuniao \~# dstat --tcp #查看tcp监控信息
----tcp-sockets----
lis act syn tim clo
10 2 0 0 0
10 2 0 0 0
root@wuzuniao \~# dstat --top-mem #查看占用CPU最高的进程
--most-expensive-
memory process
gnome-shell 139M
gnome-shell 139M
root@wuzuniao \~# dstat --top-cpu #查看占用内存最高的进程
-most-expensive-
cpu process
gnome-shell 0.2
kworker/0:1 1.0
root@wuzuniao \~#
三、查看帮助
root@wuzuniao \~# dstat --help #查看帮助
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
--plugin-name enable plugins by plugin name (see manual)
--list list all available plugins
-a, --all equals -cdngy (default)
-f, --full automatically expand -C, -D, -I, -N and -S lists
-v, --vmstat equals -pmgdsc -D total
--bits force bits for values expressed in bytes
--float force float values on screen
--integer force integer values on screen
--bw, --blackonwhite change colors for white background terminal
--nocolor disable colors (implies --noupdate)
--noheaders disable repetitive headers
--noupdate disable intermediate updates
--output file write CSV output to file
--profile show profiling statistics when exiting dstat
delay is the delay in seconds between each update (default: 1)
count is the number of updates to display before exiting (default: unlimited)
root@wuzuniao \~#