Public paste
Lil bandwidth meter script.
By: Arie | Date: Dec 30 2006 21:17 | Format: None | Expires: never | Size: 768 B | Hits: 664

  1. -- Remote --
  2.  
  3. alias bwd {
  4.   write -c firstbw.txt
  5.   write -c secondbw.txt
  6.   run -n first.bat
  7.   .timer 1 3 run -n second.bat
  8.   .timer 1 4 bwfile
  9. }
  10.  
  11. alias bwfile {
  12.   %bytes1 = $read(firstbw.txt, 5)
  13.   %d1 = $gettok(%bytes1, 2, 32)
  14.   %u1 = $gettok(%bytes1, 3, 32)
  15.   %bytes2 = $read(secondbw.txt, 5)
  16.   %d2 = $gettok(%bytes2, 2, 32)
  17.   %u2 = $gettok(%bytes2, 3, 32)
  18.   %dspeed = $calc(%d2 - %d1)
  19.   %dspeed = $calc(%dspeed / 1024)
  20.   %dspeed = $calc(%dspeed / 8)
  21.   %uspeed = $calc(%u2 - %u1)
  22.   %uspeed = $calc(%uspeed / 1024)
  23.   %uspeed = $calc(%uspeed / 8)
  24.   msg $active Down: $round(%dspeed,2)  KB/sec - Up: $round(%uspeed,2) KB/sec (3 seconds metered)
  25. }
  26.  
  27.  
  28.  
  29. -- first.bat --
  30.  
  31. netstat -e > firstbw.txt
  32.  
  33. -- second.bat --
  34.  
  35. netstat -e > secondbw.txt
Latest pastes
21 hours ago
22 hours ago
2 days ago
2 days ago
3 days ago