Linux系統分析工具之vmstat,free,ping(三)

上文介紹了工具mpstat和iostat,接着要介紹的是vmstat的使用,由於free和ping經常遇到,所以簡單概述:
6> vmstat:虛擬內存統計
描述:
  vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.
  The  first  report produced gives averages since the last reboot.  Additional reports give information on a sampling period of length delay.  The process and memory reports are instantaneous in either case.
用法:
  vmstat [-a] [-n] [delay [ count]]
  vmstat [-f] [-s] [-m]
  vmstat [-S unit]
  vmstat [-d]
  vmstat [-D]
  vmstat [-p disk partition]
  vmstat [-V]
選項:
  -a 						#顯示活動/非活動的內存
  -f 						#顯示從開機到現在的forks的數目,等同於任務的創建總數
  -n 						#只顯示頭部一次
  -s 						#顯示一個表包含各種事件計數器和內存統計
  delay 					#刷新時間間隔
  count 					#刷新次數
  -d 						#顯示磁盤相關統計信息
  -D 						#顯示活動的磁盤概要統計信息
  -p 						#指定磁盤分區統計信息
  -S						#使用指定單位顯示。參數有k K m M ,分別代表1000 1024 1000000 1048576字節(byte)默認單位爲K(1024 bytes)
  -V						#顯示vmstat版本信息。
字段描述:
 Procs
   r						#等待運行的進程的數量
   b						#睡眠的進程的數量
 Memory 
   swpd						#已使用的虛擬內存大小
   free						#空閒的內存大小
   buff						#緩衝區的內存大小
   cache					#用於高速緩存的內存大小
   inact					#不活躍的內存大小(-a option)
   active					#活躍的內存大小(-a option)
 Swap
   si					        #從磁盤交換到內存的數量(/s)
   so						#從內存交換到磁盤的的數量(/s)
   IO
   bi						#從一個塊設備接收到的塊數量(blocks/s)
   bo						#發送給一個塊設備的塊數量(blocks/s)
 System
   in						#每秒的中斷數,包含時間中斷
   cs						#每秒上下文切換的數
   CPU						#總CPU時間的百分比
   us						#運行非內核程序的時間(user time, including nice time)
   sy						#運行內核程序的時間
   id						#系統空閒時間(Prior to Linux 2.5.41, this includes IO-wait time)
   wa					        #用在IO等待的時間
   st						#從一虛擬機竊取的時間
示例:(很簡單,不再多說)
  $ vmstat 2 
  $ vmstat 2 5
  $ vmstat -s
6> free:顯示空閒和使用的內存
用法
free [-b|-k|-m|-g] [-c count] [-l] [-o] [-t] [-s delay] [-V]
參數
 -b 						#以bytes顯示內存數量
 -g 						#以gigabytes顯示內存數量	
 -k 						#以kilobytes顯示內存數量(默認)
 -m 						#以megabytes顯示內存數量
 -l 						#顯示詳細的高低內存統計
 -c count 				        #顯示幾次結果,須和-s一起使用
 -s delay 					#時間間隔
 -V 						#顯示版本號
 -o 						#以舊版本方式輸出,僅僅是沒有buffer adjusted行
 -t 						#顯示一個總計的行

更多詳情請參考手冊$ man free
7> ping:send ICMP ECHO_REQUEST to network host
用法:
ping [-LRUbdfnqrvVaAB] [-c count] [-m mark] [-i interval] [-l preload] [-p pattern] [-s packetsize] [-t ttl] [-w deadline] [-F flowlabel] [-I interface] [-M hint] [-N nioption] [-Q tos] [-S sndbuf] [-T timestamp option] [-W timeout] [hop ...] destination
幾個參數:
 -c count  					#指定數值,執行ping的次數
 -s packetsize 					#發送出去的ICMP包的大小默認56bytes,再加8bytes的ICMP表頭數據,共64bytes
 -i interval					#設定每次執行的間隔秒數
示例:
$ ping -c 5 www.baidu.com
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章