# [rrd-users] rrd daily, monthly, weekly, yearly...

Wernher Eksteen weksteen at gmail.com
Thu Nov 22 18:03:56 CET 2007

```Hi all

I'm still a newbie when it comes to rrdtool and rrds, please bear with me :-)

Currently I have graphs tracking byte/s over daily, monthly, weekly
and yearly interval's, but not getting the results I need, my daily
average seems to work fine at 5 minute interval's with a -step of 600,
but my weekly, monthly and yearly graphs seems to be completely out of
sync with values I'm getting compared to daily graphs.

For instance, on daily graphs my MAX average of bytes/s outbound
transfer rate was 8MB/s which is roughly 64Mb/s. Where as on my
weekly, monthly and yearly graphs the MAX ave was only 3MB/s... Am I
doing something wrong, or is that right?

Thinking about it, it kinda makes sense, whereby the time frame in
which data collection takes place and differs to that of the daily
which is why daily will be more accurate because of the faster rate at
which it collects data and therefor the higher AVERAGE than the rest,
but surely there must be a way to have the MAX average over a space of
time being it daily, weekly, monthly or yearly has to be the same as
the initial input value from the highest data rate being daily input?

So what I'm saying is that if my daily graph said that at 2pm I hat a
MAX average transfer rate of 8MB/s then that value needs to go into
the weekly so that when I want to back track in a week or so to come I
can say that on week 2 at that day and at that time there was a MAX
average transfer rate of 8MB/s.. the same goes to the monthly and
yearly graphs...

Am I doing something wrong, or is it the way it is ?

I have the following two bash functions:

CreateRRD ()
{
rrdtool create "\${1}" \
DS:in:DERIVE:600:0:12500000 \
DS:out:DERIVE:600:0:12500000 \
RRA:AVERAGE:0.5:1:576 \
RRA:AVERAGE:0.5:6:672 \
RRA:AVERAGE:0.5:24:732 \
RRA:AVERAGE:0.5:144:1460
}

CreateGraph ()
{
rrdtool graph "\${1}.new" -a PNG -s -"\${2}" -w 550 -h 240 -v "bytes/s" \
'DEF:ds1='\${3}':in:AVERAGE' \
'DEF:ds2='\${3}':out:AVERAGE' \
'LINE1:ds1#00FF00:Incoming Traffic' \
GPRINT:ds1:MAX:"Max %6.2lf %s" \
GPRINT:ds1:MIN:"Min %6.2lf %s" \
GPRINT:ds1:AVERAGE:"Avg %6.2lf %s" \
GPRINT:ds1:LAST:"Curr %6.2lf %s\n" \
'LINE1:ds2#0000FF:Outgoing Traffic' \
GPRINT:ds2:MAX:"Max %6.2lf %s" \
GPRINT:ds2:MIN:"Min %6.2lf %s" \
GPRINT:ds2:AVERAGE:"Avg %6.2lf %s" \
GPRINT:ds2:LAST:"Curr %6.2lf %s" \
-t "\${4}"
mv -f "\${1}.new" "\${1}"
}

Use this commands to create the initial rrds if it don't exist:

CreateRRD "\${LANRRD}

Use these commands in a script to create the graphs:

LAN Zone
=======
CreateGraph "\${RRDIMG}/landay.png" 86400 "\${LANRRD}" LAN
CreateGraph "\${RRDIMG}/lanweek.png" 604800 "\${LANRRD}" LAN
CreateGraph "\${RRDIMG}/lanmonth.png" 2678400 "\${LANRRD}" LAN
CreateGraph "\${RRDIMG}/lanyear.png" 31536000 "\${LANRRD}" LAN

Please let me know if this is correct or if I should be changing the
times or RRD values to get the right value over these times...

Many thanks!
Wernher

```