Linux常用的几个系统监控命令

1、ps 是一个强大的查看进程状态的命令。

那些进程正在运行。进程的状态,进程占用的资源等等。主要监控后台进程。相关参数

-e显示所有进程,-f全格式,-h不显示标题 -l长格式,-w宽输出
-a显示终端上的所有进程,包括其他用户的进程。
-r只显示正在运行的进程 -x显示没有控制终端的进程

最常用的是ps -aux。这个显示所有进程。

2、top
第一行:开机时间,用户数,1s,5s,15s的cpu工作负载。
第二行:从上次刷新以来总进程数,睡眠进程数,运行进程数,僵死进程数,停止进程数
第三行:内存使用状态。总的,已用的,空闲的,共享的,缓存的。
第四行:交换分区(虚拟内存)使用状态
下面的和ps显示的差不多,不过默认情况下每5秒刷新一次

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
第一行从内核角度看内存使用,第二行从应用程序角度看内存使用。

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: 空闲时间的百分比

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值