[rrd-users] Using rrdtool to create graphics for an array of sensors
A Darren Dunham
ddunham at taos.com
Wed Oct 8 02:27:47 CEST 2008
On Tue, Oct 07, 2008 at 12:30:05PM +0100, l f wrote:
> I'm a new user of rrdtool, and I have a few questions about it.
> I have read most of the tutorials and documentation, but I still
> haven't figured out a few things.
> Here's what I'd like to do:
> I collect data from a series of sensors and I'd like to store these
> values on a database. Latter, I'd like to plot a graphic out of a
> certain portion of time.
> For example, suppose I get 2 samples (x and y) once a second, for
> 24hrs (that's 86400 seconds). (I want to store all the samples, 2 per
> Following your documentation, I created:
> rrdtool create samples.rrd -b 920000000 -s 1 \
> DS:x:GAUGE:2:U:U \
> DS:y:GAUGE:2:U:U \
> (please correct me if I'm wrong in the above command)
> Do I really need to use rows=84000 in RRA? is it possible to
> "increase-rows-as-you-go" ?
No. The RRD database is a fixed size. This is useful for many types of
information where the data can expire after a certain period of time.
So you can decide that you only need a certain amount of resolution for
a period of time.
If you really had to, you could export the data into a larger RRD, but
it's better to avoid having to do so in the first place.
> then I added a few sample values:
> rrdtool update samples.rrd 920000001:1:2 920000002:2:3 920000003:3:4
> rrdtool update samples.rrd 920000004:4:5 920000005:5:6 920000006:6:7
> rrdtool update samples.rrd 920000007:7:8 920000008:8:9 920000009:9:10
> and retrieved them with:
> rrdtool fetch samples.rrd AVERAGE -s 920000001 -e 920000009
> The resulting values started at 920000002, and ended at 920000010.
> Shouldn't I get samples between 920000001 and 920000009 ?
> Then I did a sample plot:
> rrdtool graph samples.png -s 920000000 -e 920000009 \
> --x-grid SECOND:2:MINUTE:1:HOUR:1:0:%X \
> DEF:xx=samples.rrd:x:AVERAGE LINE1:xx#FF0000 \
> DEF:yy=samples.rrd:y:AVERAGE LINE1:yy#00FF00
> I did get a .png with the correct values, but the "x" grid is missing
> from the graphic. How can I make it appear?
Hm... I don't get that problem. I see the minor grid lines every two
samples, which is what you seem to be specifying. Is that not what
you're seeing? (On the size you've picked, that's four gray vertical
> Also, I'd like to select the greater of the values in each 10 sample,
> so I could plot 3600 samples in a 360 pixels wide graphic. Can this be
Largest, I think you mean? Do you still only need the data for the last
24 hours? If so, just create your graph with the right time for that,
but specify MAX instead of AVERAGE for the DEF.
rrdtool graph <blah> -s <start time> -e start+3599 \
--width 360 \
At that size, you certainly don't want to be setting the x-grid to 2
If you want to keep the consolidated data for longer than 24 hours,
create a new RRA for as long as necessary:
RRA:MAX:0.5:10:43200 # holds 5 days of 10 second resolution
More information about the rrd-users