在Solaris下,如何获取NIC输入和输出字节?

时间:2013-12-25 09:23:32

标签: byte solaris nic

在Solaris下,如何在Linux中输入和输出NIC,就像我可以使用cat /proc/net/dev选择数据两次然后计算差异一样?

2 个答案:

答案 0 :(得分:1)

您可以使用kstat,传递您的界面名称,例如:

kstat -n qfe3 1 2 | egrep "snaptime|64"
        ipackets64                      7661398
        obytes64                        1483251857
        opackets64                      6584034
        rbytes64                        4540752924
        snaptime                        5803795.88609375
        ipackets64                      7661404
        obytes64                        1483252829
        opackets64                      6584040
        rbytes64                        4540753320
        snaptime                        5803796.92155328

这里的间隔是一秒钟(精确地为1.03545953),obytes显示传出的字节并且rbytes传入的字节。

确保选择正确的界面,例如:

$ uname -a
SunOS s10u10.local.net 5.10 Generic_147441-23 i86pc i386 i86pc
$ ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
        inet 10.0.2.15 netmask ffffff00 broadcast 10.0.2.255
e1000g0:100: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.10.254 netmask ffffff00 broadcast 192.168.10.255
e1000g1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.56.2 netmask ffffff00 broadcast 192.168.56.255
$ kstat -n e1000g1 | egrep "64|snaptime"
        ipackets64                      82
        obytes64                        840
        opackets64                      14
        rbytes64                        15792
        snaptime                        1600.258974202

答案 1 :(得分:0)

尝试添加蒂姆库克的小妞:http://sourceforge.net/projects/nicstat/

    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
02:02:23      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
02:02:23     net4    0.95   21.06   11.00    4.00   88.36  5393.0  0.02   0.00
02:02:23     net1    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
02:02:23     net0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
    Time      Int   rKB/s   wKB/s   rPk/s   wPk/s    rAvs    wAvs %Util    Sat
02:02:24      lo0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
02:02:24     net4    0.29    0.06    5.00    1.00   60.00   66.00  0.00   0.00
02:02:24     net1    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00
02:02:24     net0    0.00    0.00    0.00    0.00    0.00    0.00  0.00   0.00