您的位置:首页 > 运维架构 > Linux

linux 下查看系统资源和负载,以及性能监控

2015-12-25 16:33 465 查看
1. 查看磁盘 df

[root@tbtravel ~]# df
文件系统               1K-块        已用     可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
26345340  18485276   6500192  74% /
/dev/sda1               101086     12354     83513  13% /boot
tmpfs                  1037512         0   1037512   0% /dev/shm


2. 查看内存 free和vmstat

[root@tbtravel ~]# free
total       used       free     shared    buffers     cached
Mem:       2075024    1500448     574576          0     184772     865532
-/+ buffers/cache:     450144    1624880
Swap:      4128760          0    4128760
[root@tbtravel ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
0  0      0 574576 184772 865532    0    0     0     3    2    4  0  0 100  0  0


3. 查看cpu cat /proc/cpuinfo

[root@tbtravel ~]# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
stepping	: 6
cpu MHz		: 2992.499
cache size	: 6144 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss lm constant_tsc nonstop_tsc pni ssse3 cx16 sse4_1 lahf_lm [8]
bogomips	: 5984.99
processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz
stepping	: 6
cpu MHz		: 2992.499
cache size	: 6144 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss lm constant_tsc nonstop_tsc pni ssse3 cx16 sse4_1 lahf_lm [8]
bogomips	: 5984.99


4.查看系统内存 cat /proc/meminfo

[root@tbtravel ~]# cat /proc/meminfo
MemTotal:      2075024 kB
MemFree:        573640 kB
Buffers:        184772 kB
Cached:         865536 kB
SwapCached:          0 kB
Active:        1016096 kB
Inactive:       424116 kB
HighTotal:     1179584 kB
HighFree:         6824 kB
LowTotal:       895440 kB
LowFree:        566816 kB
SwapTotal:     4128760 kB
SwapFree:      4128760 kB
Dirty:              40 kB
Writeback:           0 kB
AnonPages:      390020 kB
Mapped:          20680 kB
Slab:            48668 kB
PageTables:       1728 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   5166272 kB
Committed_AS:   615140 kB
VmallocTotal:   114680 kB
VmallocUsed:      6364 kB
VmallocChunk:   108096 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     4096 kB


5. 查看负载 w和uptime

[root@tbtravel ~]# w
16:02:40 up 45 days, 21:06,  1 user,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    172.16.50.198    15:58    0.00s  0.11s  0.01s w
[root@tbtravel ~]# uptime
16:02:51 up 45 days, 21:07,  1 user,  load average: 0.00, 0.00, 0.00


6. 查看系统整体状态 top

[root@tbtravel ~]# top
top - 16:03:47 up 45 days, 21:08,  1 user,  load average: 0.00, 0.00, 0.00
Tasks:  93 total,   1 running,  92 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2075024k total,  1501252k used,   573772k free,   184772k buffers
Swap:  4128760k total,        0k used,  4128760k free,   865536k cached
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1 root      15   0  2160  652  564 S  0.0  0.0   0:10.64 init
2 root      RT  -5     0    0    0 S  0.0  0.0   0:06.98 migration/0
3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
4 root      RT  -5     0    0    0 S  0.0  0.0   0:05.70 migration/1
5 root      34  19     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/1
6 root      10  -5     0    0    0 S  0.0  0.0   0:22.88 events/0
7 root      10  -5     0    0    0 S  0.0  0.0   0:23.45 events/1
8 root      10  -5     0    0    0 S  0.0  0.0   0:00.12 khelper
9 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kthread
13 root      10  -5     0    0    0 S  0.0  0.0   0:01.16 kblockd/0
14 root      10  -5     0    0    0 S  0.0  0.0   0:01.07 kblockd/1
15 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid
174 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/0
175 root      12  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/1
178 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 khubd
180 root      18  -5     0    0    0 S  0.0  0.0   0:00.00 kseriod
247 root      22   0     0    0    0 S  0.0  0.0   0:00.87 khungtaskd
248 root      18   0     0    0    0 S  0.0  0.0   0:00.00 pdflush
249 root      15   0     0    0    0 S  0.0  0.0   0:21.40 pdflush
250 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 kswapd0
251 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 aio/0
252 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 aio/1
471 root      12  -5     0    0    0 S  0.0  0.0   0:00.00 kpsmoused
516 root      10  -5     0    0    0 S  0.0  0.0   0:01.72 mpt_poll_0
517 root      17  -5     0    0    0 S  0.0  0.0   0:00.00 mpt/0
518 root      17  -5     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
522 root      18  -5     0    0    0 S  0.0  0.0   0:00.00 ata/0
523 root      18  -5     0    0    0 S  0.0  0.0   0:00.00 ata/1


7. 性能监视 sar -u

[root@tbtravel ~]# sar -u
Linux 2.6.18-238.el5 (tbtravel) 	2015年12月25日
00时00分01秒       CPU     %user     %nice   %system   %iowait    %steal     %idle
00时10分01秒       all      0.07      0.00      0.10      0.00      0.00     99.82
00时20分01秒       all      0.09      0.00      0.13      0.00      0.00     99.79
00时30分01秒       all      0.01      0.00      0.04      0.00      0.00     99.94
00时40分02秒       all      0.07      0.00      0.10      0.00      0.00     99.83
00时50分01秒       all      0.07      0.00      0.09      0.00      0.00     99.83
01时00分01秒       all      0.01      0.04      0.06      0.00      0.00     99.89
01时10分02秒       all      0.15      0.00      0.08      0.00      0.00     99.77
01时20分01秒       all      0.07      0.00      0.09      0.00      0.00     99.84
01时30分01秒       all      0.02      0.00      0.02      0.00      0.00     99.95
01时40分01秒       all      0.07      0.00      0.08      0.00      0.00     99.85
01时50分01秒       all      0.07      0.00      0.07      0.00      0.00     99.86
02时00分01秒       all      0.01      0.04      0.06      0.00      0.00     99.89
02时10分01秒       all      0.06      0.00      0.07      0.00      0.00     99.86
02时20分01秒       all      0.07      0.00      0.08      0.00      0.00     99.85


8. 查看文件大小 du

[root@tbtravel ~]# du -m
1	./.elinks
1	./.ssh
1	./.java/.userPrefs/com/bea/plateng/patch/?oracle?weblogic?utils?bsu
1	./.java/.userPrefs/com/bea/plateng/patch
1	./.java/.userPrefs/com/bea/plateng
1	./.java/.userPrefs/com/bea
1	./.java/.userPrefs/com
1	./.java/.userPrefs
1	./.java/fonts/1.7.0_02
1	./.java/fonts
1	./.java
1	./.gconfd
1	./.gconf/apps/gnome-session/options
1	./.gconf/apps/gnome-session
1	./.gconf/apps
1	./.gconf
1	./bea
805	.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: