日期:2014-05-16  浏览次数:20609 次

linux常用工具诊断工具使用示例1

我使用的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)