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)

       -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统计的就是硬盘的读写情况。


posted @ 2012-11-05 22:46  zhwj184  阅读(244)  评论(0编辑  收藏  举报