1、w/uptime 查看系统负载
1
2
3
4
5
6
|
[root@server01 ~]
# w ##分别为1分钟,5分钟,15分钟的负载
17:35:58 up 5:30, 1 user, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts
/0
gateway 17:32 6.00s 0.26s 0.12s w
[root@server01 ~]
# uptime
17:36:02 up 5:30, 1 user, load average: 0.00, 0.01, 0.05
|
2、/proc/cpuinfo 查看cpu核数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
[root@server01 ~]
# cat /proc/cpuinfo
processor : 0
##表示只有1个逻辑cpu
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
stepping : 9
microcode : 0x1b
cpu MHz : 2593.839
cache size : 3072 KB
physical
id
: 0
siblings : 1
core
id
: 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu :
yes
fpu_exception :
yes
cpuid level : 13
wp :
yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt xsave avx f16c rdrand hypervisor lahf_lm ida arat epb pln pts dtherm fsgsbase smep xsaveopt
bogomips : 5188.23
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
|
3、vmstat 监控系统状态
1
2
3
4
5
6
7
8
9
10
11
12
|
[root@server01 ~]
# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd
free
buff cache si so bi bo
in
cs us sy
id
wa st
2 0 0 749284 876 150960 0 0 6 1 15 18 0 0 100 0 0
[root@server01 ~]
# vmstat 1 5 ##1秒显示1次,一共显示5次
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd
free
buff cache si so bi bo
in
cs us sy
id
wa st
2 0 0 749284 876 150960 0 0 6 1 15 18 0 0 100 0 0
0 0 0 749268 876 150960 0 0 0 0 20 23 0 0 100 0 0
0 0 0 749268 876 150960 0 0 0 0 16 14 0 1 99 0 0
0 0 0 749268 876 150960 0 0 0 0 22 25 0 0 100 0 0
0 0 0 749268 876 150960 0 0 0 0 19 14 0 0 100 0 0
|
▎参数解读:
r run,运行中的进程数
b block,卡死状态
swpd swap中的进程数(影响si,so)
si 有多少kb的数据从swap进入内存中
so 有多少kb的数据从内存中进入swap中
bi 从磁盘出来进入内存,读
bo 从内存出来进入磁盘,写
us 用户占用资源百分比(us + sy + id =100)
wa wait,等待cpu的进程百分比
4、top 查看进程使用资源情况
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
[root@server01 ~]
# top ##动态显示,3秒1次
top
- 17:57:23 up 5:51, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 82 total, 2 running, 80 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.3 us, 0.0 sy, 0.0 ni, 99.7
id
, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 1008392 total, 748360
free
, 107540 used, 152492 buff
/cache
KiB Swap: 2097148 total, 2097148
free
, 0 used. 735044 avail Mem
#RES表示物理内存大小#
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3 root 20 0 0 0 0 S 0.3 0.0 0:00.07 ksoftirqd
/0
21 root 20 0 0 0 0 S 0.3 0.0 0:17.59 kworker
/0
:1
1 root 20 0 128092 6708 3952 S 0.0 0.7 0:01.87 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
......
[root@server01 ~]
# top -c ##显示详细的进程信息
top
- 17:59:12 up 5:53, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 83 total, 1 running, 82 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
KiB Mem : 1008392 total, 748164
free
, 107680 used, 152548 buff
/cache
KiB Swap: 2097148 total, 2097148
free
, 0 used. 734864 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21 root 20 0 0 0 0 S 0.3 0.0 0:17.73 [kworker
/0
:1]
2619 root 20 0 157604 2204 1608 R 0.3 0.2 0:00.01
top
-c
......
[root@server01 ~]
# top -bn1 ##静态显示
top
- 18:00:22 up 5:54, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 83 total, 1 running, 82 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.1 sy, 0.0 ni, 99.8
id
, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 1008392 total, 748316
free
, 107528 used, 152548 buff
/cache
KiB Swap: 2097148 total, 2097148
free
, 0 used. 735016 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 128092 6708 3952 S 0.0 0.7 0:01.87 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd
/0
6 root 20 0 0 0 0 S 0.0 0.0 0:00.36 kworker
/u128
:0
......
|
q退出,1显示所有核cpu。
默认按cpu排序,M按内存使用排序,P按cpu使用排序。
5、sar 系统活动情况
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
[root@server01 ~]
# yum install -y sysstat
......
已安装:
sysstat.x86_64 0:10.1.5-11.el7
作为依赖被安装:
lm_sensors-libs.x86_64 0:3.4.0-4.20160601gitf9185e5.el7
完毕!
[root@server01 ~]
# sar -n DEV ##网卡流量
Linux 3.10.0-514.el7.x86_64 (server01) 2017年07月10日 _x86_64_ (1 CPU)
18时10分02秒 IFACE rxpck
/s
txpck
/s
rxkB
/s
txkB
/s
rxcmp
/s
txcmp
/s
rxmcst
/s
18时20分01秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
18时20分01秒 ens33 0.18 0.11 0.02 0.01 0.00 0.00 0.00
平均时间: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
平均时间: ens33 0.18 0.11 0.02 0.01 0.00 0.00 0.00
23时01分06秒 LINUX RESTART
[root@server01 ~]
# sar -n DEV 1 3 ##每隔1秒显示一次,一共显示3次
Linux 3.10.0-514.el7.x86_64 (server01) 2017年07月10日 _x86_64_ (1 CPU)
23时06分46秒 IFACE rxpck
/s
txpck
/s
rxkB
/s
txkB
/s
rxcmp
/s
txcmp
/s
rxmcst
/s
23时06分47秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
23时06分47秒 ens33 1.01 1.01 0.06 0.18 0.00 0.00 0.00
23时06分47秒 IFACE rxpck
/s
txpck
/s
rxkB
/s
txkB
/s
rxcmp
/s
txcmp
/s
rxmcst
/s
23时06分48秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
23时06分48秒 ens33 1.01 1.01 0.06 0.40 0.00 0.00 0.00
23时06分48秒 IFACE rxpck
/s
txpck
/s
rxkB
/s
txkB
/s
rxcmp
/s
txcmp
/s
rxmcst
/s
23时06分49秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
23时06分49秒 ens33 1.00 1.00 0.06 0.40 0.00 0.00 0.00
平均时间: IFACE rxpck
/s
txpck
/s
rxkB
/s
txkB
/s
rxcmp
/s
txcmp
/s
rxmcst
/s
平均时间: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
平均时间: ens33 1.01 1.01 0.06 0.33 0.00 0.00 0.00
[root@server01 ~]
# sar -q ##系统负载
Linux 3.10.0-514.el7.x86_64 (server01) 2017年07月10日 _x86_64_ (1 CPU)
18时10分02秒 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked
18时20分01秒 1 100 0.00 0.01 0.05 0
平均时间: 1 100 0.00 0.01 0.05 0
23时01分06秒 LINUX RESTART
[root@server01 ~]
# sar -b ##磁盘读写
Linux 3.10.0-514.el7.x86_64 (server01) 2017年07月10日 _x86_64_ (1 CPU)
18时10分02秒 tps rtps wtps bread
/s
bwrtn
/s
18时20分01秒 0.07 0.00 0.07 0.00 0.86
平均时间: 0.07 0.00 0.07 0.00 0.86
23时01分06秒 LINUX RESTART
[root@server01 ~]
# sar -f /var/log/sa/sa10 ##历史文件,每10分钟保存一次
Linux 3.10.0-514.el7.x86_64 (server01) 2017年07月10日 _x86_64_ (1 CPU)
18时10分02秒 CPU %user %
nice
%system %iowait %steal %idle
18时20分01秒 all 0.01 0.00 0.09 0.00 0.00 99.90
平均时间: all 0.01 0.00 0.09 0.00 0.00 99.90
23时01分06秒 LINUX RESTART
[root@server01 ~]
#
|
6、nload 实时网络流量
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@server01 ~]
# yum install -y nload
已安装:
nload.x86_64 0:0.7.4-4.el7
完毕!
[root@server01 ~]
# nload ##通过左右方向键切换网卡
Device ens33 [192.168.137.100] (1
/2
):
=================================================================
Incoming:
......
Outgoing:
############################################# Curr: 78.50 MBit/s
############################################# Avg: 16.47 MBit/s
############################################# Min: 4.13 kBit/s
############################################# Max: 98.17 MBit/s
############################################# Ttl: 318.58 MByte
|
本文转自Grodd51CTO博客,原文链接:http://blog.51cto.com/juispan/1946141,如需转载请自行联系原作者