#!/bin/bash
if [ -z "$1" ]; then
echo usage: $0 [network-interface]
echo shows packets-per-second
exit
fi
IF=$1
while true
do
RX1=`cat /sys/class/net/$1/statistics/rx_packets`
TX1=`cat /sys/class/net/$1/statistics/tx_packets`
sleep 1
RX2=`cat /sys/class/net/$1/statistics/rx_packets`
TX2=`cat /sys/class/net/$1/statistics/tx_packets`
TXPPS=`expr $TX2 - $TX1`
RXPPS=`expr $RX2 - $RX1`
echo "$(date +%Y-%m-%d-%H:%M:%S) TX $1: $TXPPS pkts/s RX $1: $RXPPS pkts/s"
done
PPS检测
最新推荐文章于 2020-06-28 20:04:08 发布