[rrd-users] Re: normalisation

Alex van den Bogaerdt alex at ergens.op.het.net
Thu Apr 27 13:38:19 MEST 2006


On Thu, Apr 27, 2006 at 01:11:38PM +0200, thomas peter wrote:

> i 'grep'-ed for 'last_update' in the rrdinfo output to determine the
> value i base my calculations on.
> but when i once introduced an offset in updateing, i won't get rid of
> it, until i change the plan to gather the correct slice-time.

> >You need to have updatetime = n * 300
> 
> yes. the last 20 lines of this mail i tried to question how to determine
> n. :)

You don't need to know "n".  All you need to have is a timestamp that
is a multiple of 300.  There are several ways of getting there.

Get the current time in unix-seconds-since-epoch format.  Divide by
300, get rid of any fractional part, multiply by 300. Compute
'int(the_time / 300) * 300'

Get the current time in unix-seconds-since-epoch format and use
some modulo computation.  Compute
'the_time - (the_time modulo 300)

(how to do this depends on your chosen programming language).

You could also look at the output of 'rrdtool fetch'.  It will
provide you with plenty timestamps.

Anyway, try these (or variants thereof):
perl -e 'print int(time()/300)*300 . "\n"';
perl -e 'print time()-time%300 . "\n";'


-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/

--
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://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list