安裝
yum -y install sysstat
使用
sar -n {DEV | EDEV | NFS | NFSD | SOCK | ALL}
-n選項,使用六種不同的開關:
DEV 網絡接口資訊
EDEV 網絡錯誤的統計資料
NFS 統計活動的NFS用戶端資訊
NFSD 統計NFS伺服器端的資訊
SOCK 顯示套接字資訊
ALL 表示5個開關同時使用
sar -n DEV 2 10 (顯示網絡接口資訊,每2秒一次,共執行10次)
01:39:40 AM IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s
01:39:42 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:39:42 AM eth1 131.34 104.98 119704.48 36110.45 0.00 0.00 0.00
01:39:42 AM sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00
IFACE:LAN接口
rxpck/s:每秒鐘接收的資料包
txpck/s:每秒鐘發送的資料包
rxbyt/s:每秒鐘接收的位元組數
txbyt/s:每秒鐘發送的位元組數
rxcmp/s:每秒鐘接收的壓縮資料包
txcmp/s:每秒鐘發送的壓縮資料包
rxmcst/s:每秒鐘接收的多點傳播資料包
#sar -n EDEV 2 10
Linux 2.6.18-53.el5PAE (localhost.localdomain) 03/29/2009
01:42:18 AM IFACE rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s
01:42:20 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:42:20 AM eth1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:42:20 AM sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
rxerr/s:每秒鐘接收的壞資料包
txerr/s:每秒鐘發送的壞資料包
coll/s:每秒沖突數
rxdrop/s:因為緩沖充滿,每秒鐘丢棄的已接收資料包數
txdrop/s:因為緩沖充滿,每秒鐘丢棄的已發送資料包數
txcarr/s:發送資料包時,每秒載波錯誤數
rxfram/s:每秒接收資料包的幀對齊錯誤數
rxfifo/s:接收的資料包每秒FIFO過速的錯誤數
txfifo/s:發送的資料包每秒FIFO過速的錯誤數
#sar -n SOCK 2 10
Linux 2.6.18-53.el5PAE (localhost.localdomain) 03/29/2009
01:44:32 AM totsck tcpsck udpsck rawsck ip-frag
01:44:34 AM 243 9 8 0 0
01:44:36 AM 242 9 7 0 0
01:44:38 AM 238 9 7 0 0
01:44:40 AM 238 9 7 0 0
totsck:使用的套接字總數量
tcpsck:使用的TCP套接字數量
udpsck:使用的UDP套接字數量
rawsck:使用的raw套接字數量
ip-frag:使用的IP段數量
sar -n DEV 1 2 |grep em1
21:15:35 eth0 17.00 0.00 1.03 0.00 0.00 0.00 0.00
21:15:36 eth0 23.76 0.00 2.09 0.00 0.00 0.00 0.00
Average: eth0 20.40 0.00 1.56 0.00 0.00 0.00 0.00