[rrd-users] Re: where do the peaks come from?
Alex van den Bogaerdt
alex at ergens.op.het.net
Tue Jun 28 13:49:42 MEST 2005
On Tue, Jun 28, 2005 at 01:01:21PM +0200, Stefan Krister wrote:
> wich is showing two peaks when I rebootet. A cronjob reads from 'ifconfig'
> received=`ifconfig $interface | grep "RX bytes:" | cut -d":" -f2 | cut -d"
> " -f1`
> transmitted=`ifconfig $interface | grep "TX bytes:" | cut -d":" -f3 | cut
> -d" " -f1`
Last update before reboot is, say, 348711.
Next update after reboot is, say, 10.
The increase for a counter is: 10 - 348711 = -348701.
This is smaller than zero and counters cannot go back. Therefore, the counter
4294967296 and therefore this number is added to -348701 and you get an
increase of 4294618595.
It takes about two to three minutes to reboot. 4294618595 bytes in
150 seconds (2.5 minutes) is 28630790 bytes per second. That's the
same as 2.8630790e+07
RRDtool is doing exactly what you are asking it to do. By specifying
a counter, you are not only telling RRDtool what the current value is
but you are also implying that the difference from the previous value
should be divided by time lapsed.
If you know a reboot occured (and your computer starts up so you do
know this) you should make RRDtool aware of this. The following should
-1- Just before shutdown, update your database. This makes sure you
won't loose to much data
-2- During the startup sequence, update your database with "U" for
unknown. This way you tell RRDtool to forget about any counter
value before this update. Do this with time "$now-1" and then
update again with the current counter values.
-3- continue as usual
This way you get the following updates:
Time X: last update. RRDtool computes the rate just before shutdown.
Time Y-1: update with unknown. the rate from time X to time Y-1 is unknown
Time Y: update normally. The rate from time Y-1 to Y is unknown.
Time Z: the rate from time Y to time Z is known (and correct)
The reboot occured from Time X to Time Y. My method makes this unknown,
your program makes this a large rate as specified earlier in this mail.
Should the reboot have occured spontaniously, the same explanation can
be used however "time X" may be upto "step" seconds before the reboot.
Another method, for lazy people:
Don't use COUNTER. Use DERIVE and set the minimum allowed rate to zero.
RRDtool will come up with rate -348701 as explained above but it will
discard this rate for it is below the minimum allowed rate.
This is easy to implement yet less accurate. Pick either method.
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
More information about the rrd-users