Reputation: 27
Under Solaris, how can I get the NIC in and out bytes just like in Linux where I can use cat /proc/net/dev
to pick data two times then compute the difference ?
Upvotes: 0
Views: 594
Reputation: 486
Give Tim Cook's nicstat a try: 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
Upvotes: 0
Reputation: 30833
You can use kstat, passing the name of your interface, eg:
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
Here the interval is one second (1.03545953 precisely), obytes shows the outgoing bytes and rbytes the incoming ones.
Make sure to pick the right interface, eg:
$ 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
Upvotes: 1