Advertisement
teknoraver

shtraf

Oct 7th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. dev=$1
  4.  
  5. while sleep 1 ; do
  6.     read newrx </sys/class/net/$dev/statistics/rx_bytes
  7.     read newtx </sys/class/net/$dev/statistics/tx_bytes
  8.     read newrxp </sys/class/net/$dev/statistics/rx_packets
  9.     read newtxp </sys/class/net/$dev/statistics/tx_packets
  10.     [ -n "$rx" ] && printf 'rx: %.2f Mbps %.1f kpps tx: %.2f Mpps %.1f kpps\n' $(((newrx-rx) / 125000)) $(((newrxp-rxp) / 1000)) $(((newtx-tx) / 125000)) $(((newtxp-txp) / 1000))
  11.     rx=$newrx
  12.     tx=$newtx
  13.     rxp=$newrxp
  14.     txp=$newtxp
  15. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement