Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1098359
  • 博文数量: 414
  • 博客积分: 10030
  • 博客等级: 上将
  • 技术积分: 4440
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-05 21:42
文章分类

全部博文(414)

文章存档

2011年(1)

2009年(1)

2008年(412)

我的朋友

分类: LINUX

2008-10-06 15:56:06

1.查看进程
使用ps -aux查看系统正在运行的程序。
用top实时监控,5秒更新一次
#top
Tasks: 137 total,   2 running, 134 sleeping,   0 stopped,   1 zombie
Cpu(s): 17.6%us,  2.7%sy,  0.0%ni, 79.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    775168k total,   727984k used,    47184k free,    31008k buffers
Swap:  1052216k total,        0k used,  1052216k free,   482676k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                     
 4026 root      20   0  138m  16m 9.8m R 13.3  2.2   0:02.28 gnome-terminal                                                                                                                              
 3676 root      20   0  105m  18m 6876 S  6.0  2.4   0:21.58 Xorg                                                                                                                                        
 3941 root      20   0  265m  66m  25m S  4.0  8.8   1:03.18 firefox-bin                                                                                                                                 
 3837 root      20   0  2528 1140  940 S  0.7  0.1   0:00.06 gam_server                                                                                                                                  
 3859 root      20   0  106m  11m 8876 S  0.7  1.6   0:00.70 mixer_applet2                                                                                                                               
 3917 root      20   0 16052 1612  940 S  0.7  0.2   0:00.42 gnome-screensav                                                                                                                             
 3911 root      20   0 74320  20m  10m S  0.3  2.7   0:03.78 qq                                                                                                                                          
    1 root      20   0  2036  632  544 S  0.0  0.1   0:00.48 init                                                                                                                                        
    2 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kthreadd                                                                                                                                    
    3 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0                                                                                                                                 
    4 root      15  -5     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/0                                                                                                                                 
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0                                                                                                                                  
    6 root      15  -5     0    0    0 S  0.0  0.0   0:00.04 events/0                                                                                                                                    
    7 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 khelper                                                                                                                                     
   58 root      15  -5     0    0    0 S  0.0  0.0   0:00.10
kblockd/0
2.查看内存
使用free可以看到内存的使用情况
#free
                       total       used       free     shared    buffers     cached
Mem:        775168     734140      41028          0      31252     484464
-/+ buffers/cache:     218424     556744
Swap:      1052216          0    1052216

用vmstat也可以查看
#vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0  36572  32160 484800    0    0   447   117   88  993 14  3 75  9  0


3.系统的负载
用sar,top
#sar 1 10
作用是每秒输出一次,共输出10次,使用sar需要安装sysstat
15时45分24秒       CPU     %user     %nice   %system   %iowait    %steal     %idle
15时45分25秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分26秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分27秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分28秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分29秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分30秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分31秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分32秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分33秒       all      0.00      0.00      0.00      0.00      0.00    100.00
15时45分34秒       all      0.00      0.00      0.00      0.00      0.00    100.00
Average:          all      0.00      0.00      0.00      0.00      0.00    100.00

还可以将sar的输出结果保存到文件中:
sar 1 10 > test.txt
4.I/O
用iostat
#iostat
Linux 2.6.26.3 (yang.localdomain)       2008年10月06日

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          13.19    0.00    2.53    8.38    0.00   75.91

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
hda              25.87       808.80       219.50    1007300     273368
hda1              0.35         3.75         0.00       4668          0
hda2              0.04         0.61         0.00        756          0
hda3              0.01         0.01         0.00         18          0
hda4             25.41       802.31       219.50     999226     273368
hda5              0.04         1.72         0.00       2144          0

5.cpu
使用top和mpstat
#mpstat
Linux 2.6.26.3 (yang.localdomain)       2008年10月06日

15时53分04秒  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
15时53分04秒  all   12.99    0.00    2.28    8.05    0.17    0.04    0.00   76.47     87.88

6.网络状况
用netstat
#netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State     
tcp        0      0 0.0.0.0:57892               0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:11111               0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:945                 0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:16851               0.0.0.0:*                   LISTEN     
tcp        0      0 192.168.1.101:53            0.0.0.0:*                   LISTEN     
tcp        0      0 192.168.1.100:53            0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:53                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:23                  0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:953               0.0.0.0:*                   LISTEN     
tcp        0      0 192.168.1.100:34865         221.238.249.181:80          TIME_WAIT  
tcp        0      0 127.0.0.1:24510             127.0.0.1:57892             ESTABLISHED
tcp        0      0 192.168.1.100:34861         221.238.249.181:80          TIME_WAIT  
tcp        0      0 127.0.0.1:57892             127.0.0.1:24510             ESTABLISHED
tcp        0      0 192.168.1.100:34881         221.238.249.181:80          TIME_WAIT  
tcp        0      0 192.168.1.100:34871         221.238.249.181:80          TIME_WAIT  
tcp        0      0 :::22                       :::*                        LISTEN     
tcp        0      0 ::1:953                     :::*                        LISTEN     

                             
阅读(928) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~