linux查看系统监控命令
ps
ps 是一个强大的查看进程状态的命令。那些进程正在运行。进程的状态,进程占用的资源等等
主要监控后台进程。相关参数
-e显示所有进程,-f全格式,-h不显示标题 -l长格式,-w宽输出
-a显示终端上的所有进程,包括其他用户的进程。
-r只显示正在运行的进程 -x显示没有控制终端的进程
最常用的
是ps -aux。这个显示所有进程,
显示项的意义
user,pid不考虑
VGZ--进程占用的虚拟记忆体的大小。
RSS--占用的共享存储区大小
STAT
STAT--进程状态,这是非常重要的一项。其中的状态如下
R: 正在执行中
S: 静止状态
T: 暂停执行
Z: 不存在但暂时无法消除,也就是僵尸进程(zombie)
W: 没有足够的记忆体分页可分配
N:低优先级
L: 有记忆体分页分配并锁在记忆体内
START:进程开始的时间
TIME:进程执行的时间
command进程命令行
2 top
第一行:开机时间,用户数,1s,5s,15s的cpu工作负载。
第二行:从上次刷新以来总进程数,睡眠进程数,运行进程数,僵死进程数,停止进程数
第三行:内存使用状态。总的,已用的,空闲的,共享的,缓存的。
第四行:交换分区(虚拟内存)使用状态
下面的和ps显示的差不多,不过默认情况下每5秒刷新一次
例子
[root@localhost root]# top
18:11:19 up 1:37, 2 users, load average: 0.00, 0.00, 0.00
67 processes: 66 sleeping, 1 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 0.9% 0.0% 0.0% 0.0% 0.0% 0.0% 99.0%
Mem: 254140k av, 145172k used, 108968k free, 0k shrd, 13888k buff
108536k active, 15592k inactive
Swap: 2096440k av, 0k used, 2096440k free 68736k cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
2593 root 20 0 1092 1092 884 R 0.9 0.4 0:00 0 top
1 root 15 0 492 492 436 S 0.0 0.1 0:04 0 init
2 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 keventd
3 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kapmd
4 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd/0
7 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 bdflush
5 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kswapd
6 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kscand
8 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kupdated
9 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 mdrecoveryd
17 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
72 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 khubd
1363 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
1364 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
1365 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
1366 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
1367 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
1731 root 18 0 1004 1004 724 S 0.0 0.3 0:00 0 dhclient
1781 root 15 0 580 580 500 S 0.0 0.2 0:00 0 syslogd
1785 root 15 0 464 464 400 S 0.0 0.1 0:00 0 klogd
1813 rpc 15 0 568 568 496 S 0.0 0.2 0:00 0 portmap
1833 rpcuser 25 0 716 716 636 S 0.0 0.2 0:00 0 rpc.statd
1845 root 15 0 404 404 344 S 0.0 0.1 0:00 0 mdadm
1904 root 24 0 504 504 456 S 0.0 0.1 0:00 0 apmd
1948 root 15 0 1956 1956 1440 S 0.0 0.7 0:00 0 cupsd
1974 root 15 0 1548 1548 1296 S 0.0 0.6 0:00 0 sshd
1990 root 15 0 884 884 768 S 0.0 0.3 0:00 0 xinetd
2020 root 15 0 2548 2548 1876 S 0.0 1.0 0:00 0 sendmail
2029 smmsp 15 0 2296 2288 1752 S 0.0 0.9 0:00 0 sendmail
可以通过h查看交互名令列表
free
3 free 插看内存状态[root@localhost root]# free -m
total used free shared buffers cached
Mem: 248 141 106 0 13 67
-/+ buffers/cache: 60 187
Swap: 2047 0 2047
第一行从内核角度看内存使用,第二行从应用程序角度看内存使用。
free=free+buffers+cached.
4 vmstat
vmstat命令报告关于内核线程、虚拟内存、磁盘、陷阱和 CPU 活动的统计信息。由vmstat命令生成的报告可以用于平衡系统负载活动。系统范围内的这些统计信息(所有的处理器中)都计算出以百分比表示的平均值,或者计算其总和。
[root@localhost root]# vmstat -m 2 5
procs memory swap io system cpu
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 104 14 67 0 0 12 5 103 72 0 1 99 0
0 0 0 104 14 67 0 0 0 20 104 132 0 0 100 0
0 0 0 104 14 67 0 0 0 0 103 122 0 0 100 0
1 0 0 104 14 67 0 0 0 44 107 134 0 0 100 0
1 0 0 104 14 67 0 0 0 0 103 122 0 0 100 0
process
r 为置于运行队列的内核线程数目
b为置于等待对列的内核线程数目
cache
free : the amount of free physical memory (in KB by default)
buff : the amount of memory consumed by buffers (in KB by default)
inact : the amount of memory on the inactive list (in KB by default)
active: the amount of memory on the active list (in KB by default)
swap
si: 从磁盘写出的物理页总数(in KB/s by default)
so: 写入磁盘的物理页总数(in KB/s by default)
io
bi: 从磁盘获取的数据块总数 (in blocks/s).
bo: 写入磁盘的数据块总数 (in blocks/s).
system
in: the number of interrupts received (in interrupts/s)
cs: the number of context switches (in switches/s)
cpu
us: 用户空间消耗的cpu百分比
sy: 内黑消耗的cpu百分比
wa: i/o等待的cpu百分比
id: 空闲时间的百分比
<script type="text/javascript"></script>
linux进程事件监控 linux进程监控命令
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Linux进程间通信
进程间通信方式,命名管道,共享内存。
共享内存 管道文件 -
springboot 常见的内存泄漏
文章目录1、服务监控的实现思路2、SpringBoot Admin服务端3、SpringBoot Admin客户端4、实现原理--Actuator与端点5、关于端点 1、服务监控的实现思路监控的意义:监控服务状态是否宕机监控服务运行指标:内存、虚拟机、线程、请求等监控日志管理服务:服务下线与启动当要监控的服务很多时,一个个去查看很不方便,因此考虑引入一个显示所有服务监控信息的服务。这个服务如果只
springboot 常见的内存泄漏 spring boot 后端 java SpringBootAdmin