[rrd-users] Is it possible to create the rrd database by reading from a file?

Simon Hobson linux at thehobsons.co.uk
Wed May 16 23:58:01 CEST 2007

betamaz wrote:
>I'm new to rrdtool and have been reading up on the tutorial posted 
>on the main webpage. The examples in the tutorial describe how to 
>create a database by taking measurements. For example, using snmp or 
>it gives basic examples where the inputs are via the rrdtool create 
>command line (for example the speed inputs for test.rrd). Is there a 
>way, to read inputs from command line and create a database out of 
>that (similar to gnuplot)?

Yes, RRD doesn't care where the data comes from, all it sees are a 
series of update with timestamp and a number of values. As long as 
the timestamps a) make sense for the data, and b) are always 
increasing, then rrd will handle it.

So assuming you have a file containing a series of records, one per 
line, of the form time:value then you simply need to write a script 
of the form :

create rrd file
while (read timestamp:value pair)
   update rrd with timestamp and value
create graph

  With the exception of drawing a graph which normally takes a few 
lines of arguments, the above can be written in about the same number 
of statements in most languages (whether that be Bash shell script, 
Perl, ...). How much extra checking etc you put in is up to you and 
what you know about the source of the data - such as is the file 
format likely to be correct (ie it's created by a trustworthy 
automated tool) or do you need to do extensive validation on the 
input ?

More information about the rrd-users mailing list