#! /bin/sh RRDATAFILE=/var/log/rrd/enrutador.rrd if [ $# -lt 2 ]; then echo "Faltan los momentos de inicio y fin. Ej. (end-6h now)" exit 0 else sudo rrdtool graph /var/www/rrd/rrdtool_ejemplo.png --imgformat PNG \ --start $1 --end $2 \ --title "Comportamiento del enlace" \ --vertical-label "Tasa de transferencia (kbps)" \ --upper-limit 160 \ --lower-limit 0 \ --rigid \ --width 600 --height 240 \ DEF:dsin=$RRDATAFILE:in:AVERAGE \ DEF:dsout=$RRDATAFILE:out:AVERAGE \ CDEF:download=dsin,0.008,* \ CDEF:down96=download,96,GT,0,download,IF \ CDEF:down64=download,64,GT,0,download,IF \ CDEF:down32=download,32,GT,0,download,IF \ CDEF:down13=download,13,GT,0,download,IF \ CDEF:upload=dsout,0.008,* \ HRULE:128#0000FF:"Capacidad contratada (128 kbps)\n" \ AREA:download#35DF7F:"Recepción superior al 75%\n" \ AREA:down96#AFDF3F:"Recepción inferior al 75% (96 kbps)\n" \ AREA:down64#EFDF1F:"Recepción inferior al 50% (64 kbps)\n" \ AREA:down32#FF9F00:"Recepción inferior al 25% (32 kbps)\n" \ AREA:down13#FF0000:"Recepción inferior al 10% (13 kbps)\n" \ LINE1:download#006000 \ LINE1.5:upload#005FBF:"Envío" fi exit 0