#!/bin/bash RRDTOOL=/usr/bin/rrdtool STATSDIR=/var/www/wan-stats # Meta file # Uncomment if you don't use the data script #MF="${STATSDIR}/png.meta" # Colours # Wan link RED=FF0000 # www.freedomnet.nl GREEN=00CC00 # dns1.freedom.nl BLUE=0066FF cd "${STATSDIR}/" # Set meta file 6 mins later, refresh at 5 mins # Uncomment if you don't use the data script #echo -n "Expires: " > $MF #date --date '6 mins' -u +%a,\ %d\ %b\ %Y\ %T\ GMT >> $MF #echo "Refresh: 300" >> $MF # Dayly graph # Change the hostnames to the ones you use $RRDTOOL graph --imgformat PNG $STATSDIR/wan-ping.png \ --start -86400 \ --title "Sput link ping time" \ --vertical-label "Milliseconds" \ --x-grid HOUR:1:HOUR:6:HOUR:6:0:"%a %H:%M" \ --width 500 --height 250 \ --interlaced \ --logarithmic \ --units=si \ --lower-limit 2 \ --rigid \ COMMENT:" Current Peak (+) Peak (-) Average\n" \ DEF:lnk=$STATSDIR/wan-ping.rrd:lnk:AVERAGE \ LINE2:lnk#${RED}:"Remote PPP end " \ GPRINT:lnk:LAST:"%6.3lf" \ GPRINT:lnk:MAX:" %6.3lf" \ GPRINT:lnk:MIN:" %6.3lf" \ GPRINT:lnk:AVERAGE:" %6.3lf\n" \ DEF:www=$STATSDIR/wan-ping.rrd:www:AVERAGE \ LINE2:www#${GREEN}:"www.freedomnet.nl " \ GPRINT:www:LAST:"%6.3lf" \ GPRINT:www:MAX:" %6.3lf" \ GPRINT:www:MIN:" %6.3lf" \ GPRINT:www:AVERAGE:" %6.3lf\n" \ DEF:res=$STATSDIR/wan-ping.rrd:res:AVERAGE \ LINE2:res#${BLUE}:"dns1.freedom.nl " \ GPRINT:res:LAST:"%6.3lf" \ GPRINT:res:MAX:" %6.3lf" \ GPRINT:res:MIN:" %6.3lf" \ GPRINT:res:AVERAGE:" %6.3lf\n" \ COMMENT:" \n" \ COMMENT:" \n" \ COMMENT:" Last update\: `date '+%a %b %-d %H\:%M\:%S %Z %Y'`\n" \ COMMENT:" `date --utc '+(%a %b %-d %H\:%M\:%S %Z %Y)'`" # Weekly graphs # Change the hostnames to the ones you use $RRDTOOL graph --imgformat PNG $STATSDIR/week-wan-ping.png \ --start -604800 \ --title "Sput link ping time" \ --vertical-label "Milliseconds" \ --x-grid HOUR:6:HOUR:24:DAY:1:0:%a \ --width 500 --height 160 \ --interlaced \ --logarithmic \ --units=si \ --lower-limit 2 \ --rigid \ COMMENT:" \n" \ DEF:lnk=$STATSDIR/wan-ping.rrd:lnk:AVERAGE \ LINE2:lnk#${RED}:"Remote PPP end " \ DEF:www=$STATSDIR/wan-ping.rrd:www:AVERAGE \ LINE2:www#${GREEN}:"www.freedomnet.nl\n" \ DEF:res=$STATSDIR/wan-ping.rrd:res:AVERAGE \ LINE2:res#${BLUE}:"dns1.freedom.nl" \ COMMENT:" \n" \ COMMENT:" \n" \ COMMENT:" Last update\: `date '+%a %b %-d %H\:%M\:%S %Z %Y'`\n" \ COMMENT:" `date --utc '+(%a %b %-d %H\:%M\:%S %Z %Y)'`"