[rrd-users] Total num bytes graph solved (i think)

Mats Pettersson mog.pettersson at telia.com
Sat Jun 21 17:10:08 MEST 2003


Because my ISP now have a monthly limit of 10 GB total In/Out which if
exceeded cost 0.025 swedish kronor for each additional MB, I was trying to
solve the problem of sum up total amount of traffic for a day/week with a
climbing graph and i think i come up with a solution.

I know someone called Chris here who posted the subject *shrugs* had a
similar problem. I don't quite know how accurate my graph is (i'm not
confident with my mathematical skills :), but i think it match my traffic
ok. I actually did as Chris suggested using PREV in a CDEF, but i discovered
that since the first PREV is unknown the rest of the calculation fails, so i
just added a test and replaced PREV with 0 if PREV was unknown, as follows:

#Daily graph
rrdtool graph daily_total.png -s -24h \
DEF:bbin=/path/traffic.rrd:bin:AVERAGE \
DEF:bbout=/path/traffic.rrd:bout:AVERAGE \
'CDEF:bbbin=PREV,UN,0,PREV,IF,bbin,+' \
'CDEF:bbbout=PREV,UN,0,PREV,IF,bbout,+' \
'CDEF:byin=bbbin,bbbout,+' \    # Total In + Out traffic
'CDEF:bxin=byin,300,*' \ # Measured every 5 minute = 300 seconds
'CDEF:bein=bbbin,300,*' \
'CDEF:beout=bbbout,300,*' \
AREA:bxin#FF00AA:"Total In/Out\\n" \
LINE1:bein#00FF00:"In\\n" \
LINE1:beout#0000FF:"Out\\n" \
'GPRINT:bxin:MAX:Traf %10.2lf bytes total average'

I post this here because some others seem to have similar problems and
because maybe others can tell if my solution has any flaws or if there is a
better more accurate one. I know since i calculate from an average i get
rounding errors but maybe this is accurate enough.


Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-users mailing list