[rrd-users] Help !

Simon Hobson linux at thehobsons.co.uk
Mon Jul 4 16:15:04 CEST 2011


othmane zine wrote:

>I'm trying to retrieve data from a MySQL database to an rrd one in 
>order to generate graphs.
>
>Therefore I had two problems to solve :
>
>the first was to add a datafield time wich is not proposed so I'm 
>thinking of converting dates to number of seconds from 1970/01/01 
>until the date.

Using seconds since epoch is fine - RRD is happy with that.

>the second problem is that I'll have too much data on my base so I 
>need to select data that I want to graph and I really don't know how 
>can I do a "WHERE" clause just like in SQL.

Have you read the documentation at 
http://oss.oetiker.ch/rrdtool/doc/rrdtool.en.html ? You'll find that 
commands extracting data (fetch, graph, etc) take start and end 
arguments. So for a graph, you specify start time, end time, and 
width of the graph - and RRD will go fetch some data, and resample it 
as required to fill your graph.

For the best results, you should try and :
Make the start and end times an integer multiple of the resolution 
you intend to graph. So if your data is stored with 5 minute (300s) 
samples, you should make the start and end times (in seconds since 
epoch) an integer multiple of 300.

Have your stored samples match the pixels on the graph. So if you 
(for example) wanted a graph 400 pixels wide and showing 5 minute 
samples, you shoudl make your start time equal to "end time - (400 * 
300)".

>I'm a novice user of rrd and I really need your help because I'm 
>working on a school project and I'm really blocked I don't know what 
>to do and the deadline for the project is tomorrow morning, I did my 
>best but it seems that I need your help as soon as possible.

As long as you don't expect your schoolwork done for you ! The above 
should get you going.

-- 
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