linux基本監控 vmstat

2021-06-09 04:23:16 字數 2344 閱讀 1991

1.vmstat

vmstat(virtual meomory statistics(虛擬記憶體統計)的縮寫,很多linux、unix會預設安裝。是核心執行緒、虛擬記憶體、磁碟、陷阱和 cpu 活動的統計資訊,不足是無法對某個程序深入分析。

虛擬記憶體:

系統中執行的程序都需要使用記憶體,當記憶體不足時,核心會釋放某些程序所占用但未使用的部分或所有物理記憶體,將其移到磁碟上,並將釋放的記憶體提供給需要使用的程序。

語法:vmstat [ -f ] [ -i ] [ -s ] [ -i ] [ -t ] [ -v ] [ physicalvolume ... ] [ interval [ count ] ]

[root@db-331 ~]# vmstat help

usage: vmstat [-v] [-n] [delay [count]]

-v prints version.  

版本資訊。

-n causes the headers not to be reprinted regularly. 輸出的頭部資訊僅顯示一次。

-a print inactive/active page stats.

列印待用/活躍 的頁狀態,預設不列印。

-d prints disk statistics

列印磁碟統計資訊。

-d prints disk table      

列印磁碟總資訊,包括讀寫分割槽等。

-p prints disk partition statistics

列印磁碟分割槽統計。

-s prints vm table 

-m prints slabinfo

-s unit size    單位大小。

delay is the delay between updates in seconds.

delay表示兩次輸出之間間隔時間。

unit size k:1000 k:1024 m:1000000 m:1048576 (default is k) 指定單位,引數有k,k,m,m分別代表1000、1024、1000000、1048576(byte),預設k(1024 bytes)

count is the number of updates.

count表示統計的次數,預設1.

例如:vmstat 3 5

表示每3秒更新一次輸出資訊,統計5次。

[root@db-331 ~]# vmstat 3 5

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------

r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st

1  0    624 109784 338108 18696476    0    0     0    15    0    0  0  0 99  0  0

0  0    624 108796 338108 18697148    0    0     5   939 6693 6865  0  0 99  0  0

0  0    624 108764 338124 18697624    0    0     5  1036 6172 6325  0  0 99  0  0

0  0    624 109628 338124 18698132    0    0     0   733 5054 4822  0  0 99  0  0

0  0    624 109832 338124 18698420    0    0    11   725 5031 4875  0  0 100  0  0

procs(程序):

r: 執行佇列中程序數量。當這個值長期超過了cpu數目,表示cpu有瓶頸

b: 等待io的程序數量

memory(預設單位k):

swpd: 正使用虛擬記憶體大小

free: 可用記憶體大小

buff: 用作緩衝的記憶體大小

cache: 用作快取的記憶體大小

swap:

si: 每秒從交換區寫到記憶體的大小(由磁碟調入記憶體)

so: 每秒寫入交換區的記憶體大小(由記憶體調入磁碟)   

io:bi: 每秒讀取的塊數

bo: 每秒寫入的塊數

system:

in: 每秒中斷數,包括時鐘中斷。

cs: 每秒上下文切換數。

cpu(以百分比表示):

us: 使用者程序消耗的cpu時間百分比

sy: 系統程序消耗的cpu時間百分比

id: 空閒時間(包括io等待時間)

wa: o等待消耗的cpu時間百分比

linux監控命令 vmstat

vmstat virtual memory statistics 虛擬記憶體統計 命令用來顯示linux系統虛擬記憶體狀態,也可以報告關於程序 記憶體 i o等系統整體執行狀態。vmstat a n t s unit delay count vmstat s n s unit vmstat m n ...

Linux效能監控 vmstat

r the number of processes waiting for run time.等待執行的程序數 b the number of processes in uninterruptible sleep.處在非中斷睡眠狀態的程序數 swpd the amount of virtual me...

linux監控工具vmstat使用

vmstat是乙個檢視虛擬記憶體 virtual memory 使用狀況的工具,使用vmstat命令可以得到關於程序 記憶體 記憶體分頁 堵塞io traps及cpu活動的資訊。本文介紹了虛擬記憶體的執行原理,繼而介紹了vmstat的用法和使用範例。一 虛擬記憶體執行原理 在系統中執行的每個程序都需...