# [rrd-users] One-off and no-data-problem

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Thu Dec 30 13:34:24 CET 2010

```> Alex van den Bogaerdt wrote:
>>  > It was, but it's not enough for rrd tool to calculate a value for the
>>>  whole period.It knows that at time 400 the value was 123. Before that
>>>  it has to assume the values are unknown as you've not supplied any

Let me stress this: I know you know. However,
The way you wrote your statement may lead some to believe that the value
'123' is valid starting from time 400. It is not. It is valid until time
400, not thereafter.

>>To avoid confusion: assuming values are unknown before 300000400 is
>> wrong.
>>  After all, rrdtool updates are done at the end of an interval, not at
>> the
>>beginning.
>>
>>For COUNTER:
>>at time xyz your counter value is x
>>at time xyz+300 your counter value is x+y
>>rrdtool computes the rate at time xyz+300. The resulting rate is valid
>>between times xyz and xyz+300.
>>After this, normalization is done to make a PDP, and consolidation to get
>>a CDP.
>>
>>GAUGE is no different. The only difference at this stage is that it needs
>>not do (x+y)-x and (xyz+300-xyz). The "resulting rate" (the number being
>>fed to RRDtool) is still valid bewteen xyz and xyz+300.
>
> How does it know how far to go back when there has been no prior update ?

I cannot verify this right now, but I think that there is a 'last update'
time available right after rrdtool create.

As stated in my other reply, the time difference between these two updates
is less than \$heartbeat, so RRDtool knows the duration of the interval, it
knows the rate, and it can create PDPs and CDPs from them.

> For a counter type, there is no prior version, and so it is
> impossible to calculate a rate - unless you assume a value (zero ?)
> which IMO would be worse than assuming unknown.

Indeed, for a counter you have an unknown value at the beginning, and
{known - unknown} == unknown.

The rate is unknown because of this.

{ current_countervalue - previous_countervalue } / { current_time -
previous_time } = unknown / 401 = unknown.
This unknown rate is then valid between {previous_time} and
{current_time}. That time interval itself is known, and RRDtool knows how
much time it does not know the rate.

What is GAUGE?

Gauge means the input is already a rate.  No need to do
{current_countervalue - previous_countervalue } / { current_time -
previous_time }

When is this rate valid?
Also from {previous_time} upto and including { current_time}. Which is known.

The essential difference here is the available information, it is the
unknown counter value, which is only needed for COUNTER, not for GAUGE.

> I know you can apply the update value to the preceeding time, but how
> far back ?  To the beginning of the step period ? To the beginning of
> the RRD (start time in the create command) ? As far back as the
> heartbeat time ?

It is not a special case. As with all other updates: the rate is valid
between the previous time and the current time.
>
> Genuine question, and similar questions arise if no updates are
> received for the heartbeat interval.

Also no special case here. If your first update is further away than
\$heartbeat, then obviously the normal mechanism of making an unknown
applies.

cheers,
Alex

```