日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

网卡流量统计实用工具nicstat

發(fā)布時間:2025/3/17 编程问答 77 豆豆
生活随笔 收集整理的這篇文章主要介紹了 网卡流量统计实用工具nicstat 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

nicstat安裝

# wget -c http://nchc.dl.sourceforge.net/project/nicstat/nicstat-1.92.tar.gz # tar zxvf nicstat-1.92.tar.gz # cd nicstat-1.92 # cp Makefile.Linux Makefile # uname -m x86_64 # diff Makefile Makefile.Linux ## 如果不是64位機(jī)器則不需要修改Makefile 17c17 < CFLAGS = $(COPT) --- > CFLAGS = $(COPT) -m32 25c25 < CPUTYPE = x86_64 --- > CPUTYPE = i386 # make && make install

nicstat使用

在解壓包目錄nicstat-1.92內(nèi),有個nicstat.sh腳本.

查看網(wǎng)卡速度(-l):

[root@centos192 nicstat-1.92]# ./nicstat.sh -l Int Loopback Mbit/s Duplex State lo Yes - unkn up eth0 No 1000 full up

間隔3秒,查看2次結(jié)果(留意%Util和Sat):

[root@centos192 nicstat-1.92]# ./nicstat 3 2Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat 06:19:46 lo 0.72 0.72 2.15 2.15 341.2 341.2 0.00 0.00 06:19:46 eth0 0.89 0.15 1.37 0.92 660.4 163.6 0.00 0.00Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat 06:19:49 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 06:19:49 eth0 0.02 0.12 0.33 0.33 66.00 354.0 0.00 0.00
  • Time列:表示當(dāng)前采樣的響應(yīng)時間.
  • lo and eth0 : 網(wǎng)卡名稱.
  • rKB/s : 每秒接收到千字節(jié)數(shù).
  • wKB/s : 每秒寫的千字節(jié)數(shù).
  • rPk/s : 每秒接收到的數(shù)據(jù)包數(shù)目.
  • wPk/s : 每秒寫的數(shù)據(jù)包數(shù)目.
  • rAvs : 接收到的數(shù)據(jù)包平均大小.
  • wAvs : 傳輸?shù)臄?shù)據(jù)包平均大小.
  • %Util : 網(wǎng)卡利用率(百分比).
  • Sat : 網(wǎng)卡每秒的錯誤數(shù).網(wǎng)卡是否接近飽滿的一個指標(biāo).嘗試去診斷網(wǎng)絡(luò)問題的時候,推薦使用-x選項去查看更多的統(tǒng)計信息.

查看擴(kuò)展信息(-x 和 -s):

[root@centos192 nicstat-1.92]# ./nicstat 3 2 -x 06:33:57 RdKB WrKB RdPkt WrPkt IErr OErr Coll NoCP Defer %Util lo 0.69 0.69 2.08 2.08 0.00 0.00 0.00 0.00 0.00 0.00 eth0 0.86 0.14 1.33 0.89 0.00 0.00 0.00 0.00 0.00 0.00 06:34:00 RdKB WrKB RdPkt WrPkt IErr OErr Coll NoCP Defer %Util lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 eth0 0.02 0.12 0.33 0.33 0.00 0.00 0.00 0.00 0.00 0.00 - [root@centos192 nicstat-1.92]# ./nicstat.sh -sTime Int rKB/s wKB/s 06:37:48 lo 0.685 0.685 06:37:48 eth0 0.848 0.140

查看tcp相關(guān)信息(-t):

[root@centos192 nicstat-1.92]# ./nicstat.sh -t 05:15:05 InKB OutKB InSeg OutSeg Reset AttF %ReTX InConn OutCon Drops TCP 0.00 0.00 4.01 3.50 0.00 0.01 0.000 0.05 0.09 0.0
  • InKB : 表示每秒接收到的千字節(jié).
  • OutKB : 表示每秒傳輸?shù)那ё止?jié).
  • InSeg : 表示每秒接收到的TCP數(shù)據(jù)段(TCP Segments).
  • OutSeg : 表示每秒傳輸?shù)腡CP數(shù)據(jù)段(TCP Segments).
  • Reset : 表示TCP連接從ESTABLISHED或CLOSE-WAIT狀態(tài)直接轉(zhuǎn)變?yōu)镃LOSED狀態(tài)的次數(shù).
  • AttF : 表示TCP連接從SYN-SENT或SYN-RCVD狀態(tài)直接轉(zhuǎn)變?yōu)镃LOSED狀態(tài)的次數(shù),再加上TCP連接從SYN-RCVD狀態(tài)直接轉(zhuǎn)變?yōu)長ISTEN狀態(tài)的次數(shù)
  • %ReTX : 表示TCP數(shù)據(jù)段(TCP Segments)重傳的百分比.即傳輸?shù)腡CP數(shù)據(jù)段包含有一個或多個之前傳輸?shù)陌宋蛔止?jié).
  • InConn : 表示TCP連接從LISTEN狀態(tài)直接轉(zhuǎn)變?yōu)镾YN-RCVD狀態(tài)的次數(shù).
  • OutCon : 表示TCP連接從CLOSED狀態(tài)直接轉(zhuǎn)變?yōu)镾YN-SENT狀態(tài)的次數(shù).
  • Drops : 表示從完成連接(completed connection)的隊列和未完成連接(incomplete connection)的隊列中丟棄的連接次數(shù).

查看udp相關(guān)信息(-u):

[root@centos192 nicstat-1.92]# ./nicstat.sh -u 06:39:42 InDG OutDG InErr OutErr UDP 0.01 0.01 0.00 0.00
  • InDG : 每秒接收到的UDP數(shù)據(jù)報(UDP Datagrams)
  • OutDG : 每秒傳輸?shù)腢DP數(shù)據(jù)報(UDP Datagrams)
  • InErr : 接收到的因包含錯誤而不能被處理的數(shù)據(jù)包
  • OutErr :因錯誤而不能成功傳輸?shù)臄?shù)據(jù)包.

默認(rèn)以KB為單位,現(xiàn)在以M單位查看:

[root@centos192 nicstat-1.92]# ./nicstat.sh -MTime Int rMbps wMbps rPk/s wPk/s rAvs wAvs %Util Sat 05:16:55 lo 0.01 0.01 2.55 2.55 341.2 341.2 0.00 0.00 05:16:55 eth0 0.01 0.00 1.61 1.08 667.3 163.7 0.00 0.00

其它用法:

[root@centos192 nicstat-1.92]# ./nicstat.sh -x -t -u 06:49:25 InKB OutKB InSeg OutSeg Reset AttF %ReTX InConn OutCon Drops TCP 0.00 0.00 3.16 2.74 0.00 0.01 0.000 0.04 0.07 0.00 06:49:25 InDG OutDG InErr OutErr UDP 0.01 0.01 0.00 0.00 06:49:25 RdKB WrKB RdPkt WrPkt IErr OErr Coll NoCP Defer %Util lo 0.67 0.67 2.00 2.00 0.00 0.00 0.00 0.00 0.00 0.00 eth0 0.83 0.14 1.29 0.86 0.00 0.00 0.00 0.00 0.00 0.00

-

[root@centos192 nicstat-1.92]# ./nicstat.sh -a 06:50:43 InKB OutKB InSeg OutSeg Reset AttF %ReTX InConn OutCon Drops TCP 0.00 0.00 3.15 2.74 0.00 0.01 0.000 0.04 0.07 0.00 06:50:43 InDG OutDG InErr OutErr UDP 0.01 0.01 0.00 0.00 06:50:43 RdKB WrKB RdPkt WrPkt IErr OErr Coll NoCP Defer %Util lo 0.66 0.66 1.99 1.99 0.00 0.00 0.00 0.00 0.00 0.00 eth0 0.82 0.14 1.28 0.86 0.00 0.00 0.00 0.00 0.00 0.00

使用”-a”與使用”-x -t -u”相當(dāng).

原文發(fā)布時間為:2013-07-05

本文來自云棲社區(qū)合作伙伴“Linux中國”

總結(jié)

以上是生活随笔為你收集整理的网卡流量统计实用工具nicstat的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。