Advertisement
trishoar

mwg-stats.sh

Feb 17th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/bash
  2. #Hack job to put stuff into RRD
  3. # TH 20121212 v0.1
  4.  
  5. cd  /usr/local/sbin/proxy-stats/
  6. #define array of servers and objects we are collecting
  7. servers=(10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4)
  8.  
  9.  
  10. while(true) ;do
  11.  
  12.   for i in ${servers[@]}; do
  13.     stats=`curl -s http://255.255.255.253/mwgstats -x $i:80|grep URL\'s|egrep -o [0-9].*`
  14.     echo $stats |awk -v host=$i '{system ("rrdtool update "host".rrd N:"$1":"$2":"$3":"$4":"$5":"$6":"$7":"$8":"$9":"$10":"$11":"$12 )}'
  15.   done
  16.  
  17.   sleep 300
  18. echo `date` >/var/log/mwg.log
  19. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement