我一直在尝试计算我的机器每分钟接收 ICMP 请求的频率。
我尝试使用 tcpdump 并将结果保存到文本文件中,然后 grepping 时间戳以计算它们之间的差异,但这只会导致很多延迟。
我的方法是:
tcpdump -i eth1 icmp[0]==8 | tee abc.txt
grep -Eo '^[^ ]+' abc.txt
perl -e 'open$T,pop;while(1){while(<$T>){ ++$f{$_}>10 and print "[$f{$_}]$_" for /(\d+:\d+)/ }sleep 1;seek $T,0,1}' abc.txt
有没有办法计算在我的机器上接收到 ICMP 请求的频率而不使用任何文件?
我正在从一台机器 ping 到另一台机器,并想计算在接收端接收到 ping 的频率。