设为首页 收藏本站
查看: 331|回复: 0

[经验分享] linux常用工具诊断工具使用示例1

[复制链接]

尚未签到

发表于 2016-3-19 11:25:05 | 显示全部楼层 |阅读模式
  我使用的ubutun,安装用apt-get非常方便。
  

weijianzhongwj@ubuntu:~$ 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
16   5  77   2   0   1| 181k  147k|   0     0 |1439B 6319B|1234  6234
1   1  95   3   0   0|   0    92k|   0     0 |   0     0 | 814   999
2   1  97   0   0   1|   0     0 |   0     0 |   0     0 | 821   966
1   1  98   0   0   0|   0     0 |   0    86B|   0     0 | 802   798
1   0  98   0   0   0|   0     0 |   0     0 |   0     0 | 781   742
2   1  98   0   0   0|   0     0 |   0     0 |   0     0 | 801   834
1   1  95   3   0   1|   0   104k|5591B 3433B|   0     0 | 876  1239
1   1  98   0   0   0|   0     0 | 658B 2023B|   0     0 | 829   911 ^C
weijianzhongwj@ubuntu:~$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
0  0  61876 125672 427420 491748    0    2    68    69  308  571 16  5 77  2
0  0  61876 125672 427464 491704    0    0     0   176  358 1042  1  1 95  3
0  0  61876 125528 427464 491748    0    0     0     0  347  750  2  1 97  0
0  0  61876 125480 427464 491748    0    0     0     0  679  737  2  1 98  0
0  0  61876 125376 427464 491748    0    0     0    12  771  706  1  1 99  0
^C
weijianzhongwj@ubuntu:~$ iostat
Linux 3.5.0-17-generic (ubuntu) 2012年11月05日 _i686_(4 CPU)
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
15.52    0.01    5.45    1.89    0.00   77.13
Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda              12.38       181.16       147.01    1974352    1602164
weijianzhongwj@ubuntu:~$ ifstat
eth0               wlan0      
KB/s in  KB/s out   KB/s in  KB/s out
0.00      0.00      0.00      0.00
0.00      0.00      0.00      0.00
0.00      0.00      0.00      0.09
0.00      0.00      0.00      0.00
0.00      0.00      0.00      0.00
0.00      0.00      0.00      0.00
^C

  
  
  dstat系统资源检测工具,可以统计的数据包括
  

OPTIONS
-c, --cpu
enable cpu stats (system, user, idle, wait, hardware interrupt, software interrupt)
-C 0,3,total
include cpu0, cpu3 and total (when using -c/--cpu)
-d, --disk
enable disk stats (read, write)
-D total,hda
include total and hda (when using -d/--disk)
-g, --page
enable page stats (page in, page out)
-i, --int
enable interrupt stats
-I 5,10
include interrupt 5 and 10 (when using -i/--int)
-l, --load
enable load average stats (1 min, 5 mins, 15mins)
-m, --mem
enable memory stats (used, buffers, cache, free)
-n, --net
enable network stats (receive, send)
-N eth1,total
include eth1 and total (when using -n/--net)
-p, --proc
enable process stats (runnable, uninterruptible, new)
-r, --io
enable I/O request stats (read, write requests)
-s, --swap
enable swap stats (used, free)
-S swap1,total
include swap1 and total (when using -s/--swap)
-t, --time
enable time/date output
-T, --epoch
enable time counter (seconds since epoch)
-y, --sys
enable system stats (interrupts, context switches)
--aio  enable aio stats (asynchronous I/O)
--fs   enable filesystem stats (open files, inodes)
--ipc  enable ipc stats (message queue, semaphores, shared memory)
--lock enable file lock stats (posix, flock, read, write)
--raw  enable raw stats (raw sockets)
--socket
enable socket stats (total, tcp, udp, raw, ip-fragments)
--tcp  enable tcp stats (listen, established, syn, time_wait, close)
--udp  enable udp stats (listen, active)
--unix enable unix stats (datagram, stream, listen, active)
--vm   enable vm stats (hard pagefaults, soft pagefaults, allocated, free)
--plugin-name
enable (external) plugins by plugin name, see PLUGINS for options
Possible internal stats are
aio, cpu, cpu24, disk, disk24, disk24old, epoch, fs, int, int24, io, ipc, load, lock, mem, net, page, page24, proc, raw,
socket, swap, swapold, sys, tcp, time, udp, unix, vm
--list list the internal and external plugin names
-a, --all
equals -cdngy (default)
-f, --full
expand -C, -D, -I, -N and -S discovery lists
-v, --vmstat
equals -pmgdsc -D total
--float
force float values on screen (mutual exclusive with --integer)
--integer
force integer values on screen (mutual exclusive with --float)
--bw, --blackonwhite
change colors for white background terminal
--nocolor
disable colors (implies --noupdate)
--noheaders
disable repetitive headers
--noupdate
disable intermediate updates when delay > 1
--output file
write CSV output to file
--profile
show profiling statistics when exiting dstat

  
  比如:
  

weijianzhongwj@ubuntu:~$ dstat --fs
--filesystem-
files  inodes
8800  21186
8640  20966
8640  20966
8640  20968 ^C
weijianzhongwj@ubuntu:~$ dstat -T
--epoch---
epoch   
1352126322
1352126323
1352126324
1352126325^C
weijianzhongwj@ubuntu:~$ dstat --ipc
--sysv-ipc-
msg sem shm
0   1  31
0   1  31
0   1  31
0   1  30^C
weijianzhongwj@ubuntu:~$ dstat --socket
------sockets------
tot tcp udp raw frg
676  10   5   0   0
676  10   5   0   0
673   7   5   0   0
673   7   5   0   0
673   7   5   0   0
673   7   5   0   0
673   7   5   0   0^C

  
  
  ifstat是统计所有网卡的输入输出流量的。
  vmstat主要统计的就是内存的使用情况了。
  iostat统计的就是硬盘的读写情况。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-192812-1-1.html 上篇帖子: linux下bluetooth编程(五)bluetooth与socket 下篇帖子: 看我linux如何防SYN攻击,挺实用的
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表