监控系统状态(上)

简介:

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,如需转载请自行联系原作者

相关文章
|
9天前
|
数据采集 人工智能 安全
|
5天前
|
机器学习/深度学习 人工智能 前端开发
构建AI智能体:七十、小树成林,聚沙成塔:随机森林与大模型的协同进化
随机森林是一种基于决策树的集成学习算法,通过构建多棵决策树并结合它们的预测结果来提高准确性和稳定性。其核心思想包括两个随机性:Bootstrap采样(每棵树使用不同的训练子集)和特征随机选择(每棵树分裂时只考虑部分特征)。这种方法能有效处理大规模高维数据,避免过拟合,并评估特征重要性。随机森林的超参数如树的数量、最大深度等可通过网格搜索优化。该算法兼具强大预测能力和工程化优势,是机器学习中的常用基础模型。
314 164
|
4天前
|
机器学习/深度学习 自然语言处理 机器人
阿里云百炼大模型赋能|打造企业级电话智能体与智能呼叫中心完整方案
畅信达基于阿里云百炼大模型推出MVB2000V5智能呼叫中心方案,融合LLM与MRCP+WebSocket技术,实现语音识别率超95%、低延迟交互。通过电话智能体与座席助手协同,自动化处理80%咨询,降本增效显著,适配金融、电商、医疗等多行业场景。
320 155
|
5天前
|
编解码 人工智能 自然语言处理
⚽阿里云百炼通义万相 2.6 视频生成玩法手册
通义万相Wan 2.6是全球首个支持角色扮演的AI视频生成模型,可基于参考视频形象与音色生成多角色合拍、多镜头叙事的15秒长视频,实现声画同步、智能分镜,适用于影视创作、营销展示等场景。
358 4
|
12天前
|
SQL 自然语言处理 调度
Agent Skills 的一次工程实践
**本文采用 Agent Skills 实现整体智能体**,开发框架采用 AgentScope,模型使用 **qwen3-max**。Agent Skills 是 Anthropic 新推出的一种有别于mcp server的一种开发方式,用于为 AI **引入可共享的专业技能**。经验封装到**可发现、可复用的能力单元**中,每个技能以文件夹形式存在,包含特定任务的指导性说明(SKILL.md 文件)、脚本代码和资源等 。大模型可以根据需要动态加载这些技能,从而扩展自身的功能。目前不少国内外的一些框架也开始支持此种的开发方式,详细介绍如下。
890 6

热门文章

最新文章