[rrd-users] Doubt in RRDDef
Simon Hobson
linux at thehobsons.co.uk
Wed Apr 20 14:08:58 CEST 2011
mini priyanka wrote:
>The method setStep is present in RRDDef.Can anyone let me know what is it?
>
>Say for example, if i set the step to default value 300s and
>heartbeat for each DS as 20 minutes. And I get data only once in 15
>minutes.In that case can I update the RRD every 15 minutes or should
>I metion the step as 15 mins? Can I configure the step after the RRD
>file is created?
I think you need to set the step when you create the database.
Before suggesting whether your settings may or may not be
appropriate, you need to understand that they are.
STEP is the fundamental time period used by RRD Tools. Whatever value
you use, RRD stores data in 'buckets' of exactly that length.
Heartbeat is a measure of how old your data can be before it's
considered invalid. For some applications it may be valid to collect
data intermittently, and use that to fill in a large period of time
in the past. For example, you could have an electricity meter that
just outputs a pulse every time a certain amount of electricity has
been used - you count those pulses and update an RRD file each time
you get one. When you're using very little electricity, the pulses
may be a long time apart - but it's valid to say that over the
previous 10 hours you averaged 1/10th of a pulse per hour. When using
more electricity, the updates will be more frequent and the usage
more detailed. Thus you may want a long heartbeat to allow this "old"
data to be used.
On the other hand, say you were measuring the speed of a car. The
speed measured at any instant is not really indicative of what speed
you were doing a minute ago, and completely unrepresentative of the
speed you were doing an hour ago. Thus a short heartbeat would be
more appropriate.
BTW - these are not suggested as real situations - both could be
handled better in different ways.
Lastly, you will need to consolidate the data. Say you were using a 5
minute STEP size (300 seconds). That will allow you to plot graphs of
data with 5 minute resolution. But over a year the quantity of data
would be large, and the processing to draw a graph significant. For
example, if you plotted a graph with one day/pixel then RRD would
need to consolidate 288 samples for each pixel - every time you draw
the graph. So RRD allows you to consolidate the data as it goes. If
you ask it to consolidate 288 steps into one consolidated data point
(CDP), then graphing is just a matter of mapping one CDP to one
pixel. Not only that, but you could store a couple of years with only
730 CDPs, rather than having to keep over 210,000 unconsolidated
samples.
Alex has some excellent tutorials at http://www.vandenbogaerdt.nl/rrdtool/
Note especially the one on Normalisation and Consolidation.
Now, back you your specific question. If you have a step of 300 (5
minutes), a heartbeat of 20 minutes, and update every 15 minutes ...
Then for each update, you will "fill in" the data for the previous 3 steps.
Whether this is right depends on what you want to do with the data.
If you plot it then you'll find you have flat segments 3 steps long
in the graph. If you never want data more detailed that 15 minutes
then you may be better using a step of 900 (15 minutes).
On the other hand you can collect and update data as often as you
wish. So you could collect data every few seconds, and RRD will
simply accumulate it until a step is complete - at which point it
will fill in the value for the step period just completed and start
accumulating for the next. RRD will never store data more detailed
than your step size - so even if you collected every second, you'd
still only get one value per step.
--
Simon Hobson
Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.
More information about the rrd-users
mailing list