#!/bin/bash

AGORA=`date +"%s"`
INICIO=$(($AGORA - 14400))

rrdtool graph                                                        \
     /home/herlon/Documents/rrd/ifinout.png                          \
     --width 1600			                             \
     --height 470						     \
     --title "Trafego de entrada e saída - Minha Casa"               \
     --start=$INICIO                                                 \
     --end=$AGORA                                                    \
     DEF:in=/home/herlon/Documents/rrd/database.rrd:in:MAX           \
     DEF:out=/home/herlon/Documents/rrd/database.rrd:out:MAX         \
     CDEF:bitsin=in,8,*					             \
     CDEF:bitsout=out,8,*				             \
     AREA:bitsin#00ff00                                              \
     LINE1:bitsin#009600:"in "                                       \
     GPRINT:bitsin:MAX:"Max\\: %5.1lf %s"                            \
     GPRINT:bitsin:AVERAGE:"Avg\\: %5.1lf %s"                        \
     GPRINT:bitsin:LAST:"Current\\: %5.1lf %sbits/sec\\n"            \
     LINE1:bitsout#0000ff:"out"                                      \
     GPRINT:bitsout:MAX:"Max\\: %5.1lf %s"                           \
     GPRINT:bitsout:AVERAGE:"Avg\\: %5.1lf %s"                       \
     GPRINT:bitsout:LAST:"Current\\: %5.1lf %sbits/sec\\n"
