SHARE
TWEET

Untitled

a guest Jun 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --------------------------------
  2. Transit : Bandwidth Usage Breakdown
  3. --------------------------------
  4. Last Month Usage Breakdown:
  5.  
  6.        From: Tue Jan  1 00:00:00 CST 2013
  7.          To: Fri Feb  1 00:00:00 CST 2013
  8.  
  9.   GBytes     IN =   184.661
  10.   GBytes    OUT =   944.873
  11.           -----------------
  12.           TOTAL =  1129.534
  13.  
  14.   95th Percentile:  9.866 Mbps
  15.  
  16. --------------------------------
  17. Month-To-Date Usage Breakdown:
  18.  
  19.        From: Fri Feb  1 00:00:00 CST 2013
  20.          To: Mon Feb 11 07:33:37 CST 2013
  21.  
  22.   GBytes     IN =    60.902
  23.   GBytes    OUT =   287.265
  24.           -----------------
  25.           TOTAL =   348.168
  26.  
  27.   95th Percentile:  9.906 Mbps
  28.  
  29. --------------------------------
  30. Current Month Projection Usage Breakdown:
  31.  
  32.        From: Fri Feb  1 00:00:00 CST 2013
  33.          To: Fri Mar  1 00:00:00 CST 2013
  34.  
  35.   GBytes     IN =    60.902
  36.   GBytes    OUT =   287.265
  37.           -----------------
  38.           TOTAL =   348.168
  39.  
  40.   95th Percentile:  9.412 Mbps
  41.  
  42. --------------------------------
  43.      
  44. #!/bin/bash
  45.  
  46. IFACE=${1-eth0}
  47. INTERVAL=${2-10}
  48. # Generate environment vars RX1,RX2 and TX1,TX2 which are 10 seconds apart:
  49. eval $(
  50.     ifconfig  $IFACE | grep '[RT]X packets' | awk '{print $1" "$5}' | sed 's/ /1=/'
  51.     sleep $INTERVAL
  52.     ifconfig  $IFACE | grep '[RT]X packets' | awk '{print $1" "$5}' | sed 's/ /2=/')
  53.  
  54. # Convert to kbit/sec:
  55. let "RX=($RX2-$RX1)*8/$INTERVAL / 1000"
  56. let "TX=($TX2-$TX1)*8/$INTERVAL / 1000"
  57.  
  58. # BX is the max of both:
  59. let "BX = $TX > RX ? $TX : $RX"
  60.  
  61. echo $BX RX=$RX TX=$TX BX=$BX $(date '+%F %H:%M:%S')
  62.      
  63. */5  *  *  *  * root /usr/local/bin/95th.sh eth0 >> /var/log/95th-percent.log
  64.      
  65. DATE=2019-06
  66. PERCENTILE=95
  67. grep $DATE /var/log/95th-percent.log | sort -nr | head -n $(( $( grep -c $DATE /var/log/95th-percent.log ) * (100-$PERCENTILE) / 100 )) | tail -1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top