[rrd-developers] SQL Backend request

Martin Sperl rrdtool at martin.sperl.org
Wed May 16 07:01:25 CEST 2007


Hi Robert!

See: 
https://lists.oetiker.ch/pipermail/rrd-developers/2006-November/001813.html  
for the patch.

There is one other patch to this if the library which can help with 
detecting "wraparounds" when using counter style data-sources:
--- src/rrd_fetch_libdbi.c.1    2007-01-17 19:07:58.000000000 +0000
+++ src/rrd_fetch_libdbi.c      2007-01-17 19:12:14.000000000 +0000
@@ -185,7 +185,7 @@
       return NULL;
     }
     /* now clean result table */
-    if (! rrd_fetch_dbi_do_sql(conn,"INSERT INTO tmpVals SELECT 
t1.grouped,t1.time,(t1.value-t2.value)/(t1.time-t2.time) FROM tmpDerive1 
as t1
, tmpDerive2 as t2 WHERE t1.id=t2.id AND t1.time<>t2.time AND t1.value 
IS NOT NULL AND t2.value IS NOT NULL;",1)) {
+    if (! rrd_fetch_dbi_do_sql(conn,"INSERT INTO tmpVals SELECT 
t1.grouped,t1.time,(t1.value-t2.value)/(t1.time-t2.time) FROM tmpDerive1 
as t1
, tmpDerive2 as t2 WHERE t1.id=t2.id AND t1.time<>t2.time AND t1.value 
IS NOT NULL AND t2.value IS NOT NULL AND t1.value-t2.value>-10000000;",1
)) {
       rrd_fetch_dbi_do_sql(conn,"DROP TEMPORARY TABLE 
tmpVals,tmpDerive1,tmpDerive2",1);
       return NULL;
     }

(It is dirty, as hardcoded, and that is why I have not published it up 
to now... But If you need something like this, then you can use it)

We are currently updating 179135 different data sources every 5 minute 
to the database, but I have to warn you, that with this many 
data-sources you have to have a clever database design with migrations 
etc... to keep the DB efficient over longer periods of times...

Ciao,
          Martin

Robert Halstead wrote:
> I while ago I noticed a topic that let rrdtool use a database 
> backend.  What is the status with this project?  Also, has this turned 
> out to be a viable solution when updating large amounts of rrd files?  
> We're currently exploring other storage media to help our writes 
> become faster.  We are currently writing just under 100K rrd files and 
> have distributed writing.  We were thinking of modifying rrdtool to 
> use a MySql database and would like to modify the database beackend I 
> saw on the list (if needed) accordingly so that we don't have to 
> re-invent the wheel.
>
> I tried to look through the archives, but was only seeing patches to 
> the library file.  Is there a place to get the whole thing at?  I 
> couldn't see it in the /lib or /contrib download directories of the 
> main site.
>
> -- 
> "A fool acts, regardless; knowing well that he is wrong. The ignoramus 
> acts on only what he knows, but all that he knows.
> The ignoramus may be saved, but the fool knows that he is doomed."
>
> Robert Halstead
> ------------------------------------------------------------------------
>
> _______________________________________________
> rrd-developers mailing list
> rrd-developers at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20070516/f1219d9c/attachment.html 


More information about the rrd-developers mailing list