0

I am using Ubuntu.

I need to count the number of packet received in a specific interface. I found this can be done using netstat. However, I need to count starting from t=zero until a specific time I want (t=...) and the counter shall be start from zero

This can be done if everytime I restart the computer so the counter starts from zero, but I just want to know if there is any other solution to capture how many packets on a specific interface within a certain time I want.

Kenny Rasschaert
  • 9,045
  • 3
  • 42
  • 58
sateayam
  • 137
  • 2
  • 8
  • Interface stats are available via SNMP. – Zoredache Jan 30 '12 at 18:13
  • @zoredache : yes, and also in other tools that basically take the stat from /proc/sys.. but i am curious how to make the packet counter to 0, without having to restart the machine all the time – sateayam Jan 30 '12 at 18:37
  • http://serverfault.com/questions/23687/how-do-i-clear-the-interface-stats-on-linux – Zoredache Jan 30 '12 at 19:06
  • @Zoredache : lol linkception :D thank you (unfortunately you post in comment, not the answer. I can not accept the answer) – sateayam Jan 30 '12 at 19:12
  • If that question does have the answers you need, then I'll vote to close this question as a duplicate of that. – Zoredache Jan 30 '12 at 19:36

2 Answers2

0

use nstat(coming from iproute2 instead of deprecated net-tools) instead, ref https://superuser.com/questions/1590901/reset-netstat-statistics

0

I am afraid there is no way to reset counters without restarting ( or unload-load cycle nic card module if nic is loaded via dynamic module.)

Virtual zero-ing concept is discussed here though.

kaji
  • 2,528
  • 16
  • 17