[rrd-users] Re: is this right?

Alex van den Bogaerdt alex at ergens.op.het.net
Sat Mar 1 11:11:43 MET 2003

On Thu, Feb 27, 2003 at 10:55:28AM -0800, Arthur Cinader Jr. wrote:

> #!/bin/bash
> rrdb=/home/sc/rrdtest/test.rrd
> five_min=300
> day=86400
> week=604800
> year=31536000
> time=($five_min $day $week $year)
> for t in ${time[*]}
> do
>   /usr/local/rrdtool-1.0.41/bin/rrdtool graph $rrdb \
>    --start -$t  \

This is:  start at "now" minus one interval.  This probably isn't
what you want.

If you want to display the last interval that has been completed,
you want to set start and end time like this:

end time:    integer(current_time / $t ) * $t
start time:  end time - $t

>    DEF:avg_inoctets=$rrdb:input:AVERAGE \

This is getting its input from the RRA containing averages.
You are collecting one row and thus you won't have any difference
between min(row), avg(row) and max(row).

> "CDEF:avg_in_kbps=avg_inoctets,8,*,1000,/" \

number of octets multiplied by 8 then divided by 1000.  This
will get you kilobits per second.

>    PRINT:avg_in_kbps:AVERAGE:%lf \

print kilobits per second, for the most recently interval
(most recently because that's what you queried).

>    DEF:max_inoctets=$rrdb:input:MAX \
> "CDEF:max_in_kbps=max_inoctets,8,*,1000,/" \
>    PRINT:max_in_kbps:MAX:%lf

Do the same, now for the RRA containing maxima.

> rrdtool create test.rrd         \
>             DS:input:COUNTER:600:U:U   \
>             DS:output:COUNTER:600:U:U  \
>             RRA:AVERAGE:0.5:1:600      \
>             RRA:AVERAGE:0.5:6:700      \
>             RRA:AVERAGE:0.5:24:775     \
>             RRA:AVERAGE:0.5:288:797    \
>             RRA:MAX:0.5:1:600          \
>             RRA:MAX:0.5:6:700          \
>             RRA:MAX:0.5:24:775         \
>             RRA:MAX:0.5:288:797

Each of the intervals starts and ends at a time which is a whole
multiple of the step time multiplied by the number of steps per
entry in an RRA.

You're using the default of 300 seconds per step.
"RRA:AVERAGE:0.5:1:600" means: 600 rows of 1 step per row.

Each of the rows in this RRA starts at "n*300*1" and ends "300*1"
seconds thereafter.

"RRA:AVERAGE:0.5:6:700": 700 rows of 6 steps per row.  Start and
end times are "n*300*6" and "(n+1)*300*6"

and so on.

If you want to be sure you're accessing the correct RRA, you need
to make sure you are querying *exactly* those borders.  Therefore
you want to do the 

   end time:    integer(current_time / $t ) * $t
   start time:  end time - $t

stuff.  This will skip the interval that isn't completed yet
(such as the currently being filled interval in the RRA containing
rows of 86400 seconds per row).

"--start now-86400" "--end now" is completely different than
"--start end-86400" "--end x" (where x is calculated as above).

Much of what looks like rudeness in hacker circles is not intended to give
offence. Rather, it's the product of the direct, cut-through-the-bullshit
communications style that is natural to people who are more concerned about
solving problems than making others feel warm and fuzzy.


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