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

Serge Maandag serge.maandag at staff.zeelandnet.nl
Mon Jun 23 14:13:57 MEST 2003

```If you just need to gprint the single value for a known timespan, use
Alex' method.

If you want to graph the bytes in a line or area, you'll need to adapt
to the way the rrd database is organized. See:
http://www.ee.ethz.ch/~slist/rrd-users/msg06596.html to get an idea.

The amount by which you multiply your Bps is depending on the width of

Serge.

-----Original Message-----
Sent: Saturday, June 21, 2003 5:10 PM
To: RRD Users
Subject: [rrd-users] Total num bytes graph solved (i think)
Importance: Low

Hi!

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.

Mats

--
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