Menu

Combining 2 RRD files

2009-03-16
2013-05-09
  • Igor Sfiligoi

    Igor Sfiligoi - 2009-03-16

    Hi.

    I was looking at the available classes on 0.3, but, cannot find a good way to combine two RRDs.

    Any suggestion?

     
    • Frank Wuerthwein

      Depends what you need.

      Plotting them together should be easy enough; each data series has its own timeline.

      However, I do see a problem if you want to do arithmetics (like adding two data sources together). Will try to improve it in the next release.
      What about using the time (rounded to RRA step) as the index (instead of the current internal index)?

       
      • Frank Wuerthwein

        Added (in the head) to rrdFlotSupport classes the option to round timestamps to the closest step.

        This should help to compare different RRDs, as long as they use the same step.

         
        • Igor Sfiligoi

          Igor Sfiligoi - 2009-03-18

          Uhm, this is nice, but does not really solve the problem.
          The output is a list, not a dictionary.

          So it is far from trivial to do match on the elements.

           
    • Frank Wuerthwein

      I have added rrdMatrixFlot class.
      This class allows for plotting of a set of similar RRDs (like subsets of a problem).

      Not exactly the replacement of rrdtoll graph, but should cover many use cases.

       
  • Pryz

    Pryz - 2010-09-01

    Hi,
    I have a problem with the rrdMatrixFlot class. When I use it to display two or three RRDs the result is the sum of all.
    Do you have a tip or a kind of solution for this ?

    Thx for your work !

     
  • Pryz

    Pryz - 2010-09-01

    I think I don't understand the result of the class … In the example, when all rrds are checked they are all added one above the other. Am I wrong ?
    I would like to display all my rrds on the same draw but in keeping good scales. Can I do this with the rrdMatrixFlot ?

     
  • Michael

    Michael - 2011-07-12

    This is an old thread, but I just ran into the same issue.  If you're saying that  rrdMatrixFlot can only sum the data given, then it isn't useful to me at all. 

    Is there some other way to display multiple DSes, from multiple RRD files on one graph?  RRDtool itself can do this just fine.

     
  • Igor Sfiligoi

    Igor Sfiligoi - 2011-07-12

    First, yes, the javascriptRRD is not as easy to use as rrdtool graph.
    I have no problems admitting that.

    Said that, you should be able to do pretty much the same things, it may just be a bit more work.

    rrdMatrixFlot is meant to display a single DS from multiple RRDs. It is not "just summing them up".

    What you want, is probably the rrdMultiFile class.
    See:
    http://javascriptrrd.sourceforge.net/docs/javascriptrrd_v0.6.0/doc/lib/rrdMultiFile_js.html

    Hope this helps.

    Igor

     
  • Michael

    Michael - 2011-07-12

    I was looking at that first, but from what I could figure out from the docs and the code, that only works if each RRD file contains a DS of the same name.  Mine have different DS names, and so making a rrdMultiFile won't work.

    Please correct me if this is not the case.

     
  • Michael

    Michael - 2011-07-12

    Also, I just noticed that the rrdMultiFile doc says specifically "summed up" - as I said, I do not want to sum anything here.

    If knowing what I'm trying to actuall do helps, I'm trying to display the output of four temperature sensors (which live in seperate RRD files) on the same graph.  Right now, this does not seem to be possible with this library.

     
  • Igor Sfiligoi

    Igor Sfiligoi - 2011-07-12

    I see.

    Well, as I said, a lot of things are possible, it may just be more complex ;)
    And this one does not seem too bad, actually.

    So, what you want to do is:
    For each RRDFile object, create a RRDFilterOp object that has the all 4 DS's, with the one existing in the original RRD populated with real values, and the other 3 set to 0.
    Then sum them up with RRDFileSum.

    Now you have a single logical RRD object containing all 4 DS's from the 4 RRDs.

    Igor

     
  • Michael

    Michael - 2011-07-12

    Okay, I see what you're saying, but I'm not sure how to do this.  The sum, no problem, that's clear.

    However, my attempts to create this filter are failing.  You provide examples for the "the one existing in the original RRD populated with real values" (as the DoNothing() class), but I'm not seeing how to use this and a "return only zero" class that I've made, to do the RRDFilterOp as you suggest.

    The documentation on this is a bit unclear as to what RRDFilterOp() is expecting its argument list to be, and what it returns.

    (also it seems to be incorrect - the DoNothing class refers to 'ds1_name' which isn't defined therein, and the RRDFilterOp() call has one 'new' for DoNothing() as the first argument, but not any other uses of 'new'.  What is this implying?)

     
  • Igor Sfiligoi

    Igor Sfiligoi - 2011-07-12

    The DoNothing not what you want to use; it just copies over an existing DS.

    What you want is something like
    function Zero(ds_name) { //create a fake DS.
         this.getName = function() {return ds_name;}
         this.getDSNames = function() {return ;}
         this.computeResult = function(val_list) {return 0;}
       }

    On how to use the filters in general, see this example:
    http://javascriptrrd.sourceforge.net/docs/javascriptrrd_v0.6.0/src/examples/rrdJFlotFilter.html

    Igor

     
  • Michael

    Michael - 2011-07-12

    Ah!  The thing I missed is the return of getDSNames() should be an empty list, I had everything else in my Zero() class.

    I was reading the filters example, but this tiny part wasn't very clear.  Thanks!

     
  • Matthias Lemke

    Matthias Lemke - 2011-07-13

    I am also interested in teh result displaying 1 DS in multiple RRDs.

     
  • Igor Sfiligoi

    Igor Sfiligoi - 2011-07-13

    Either use rrdMatrixFlot, or do as suggested above, renaming the DS's in the process.

    Igor

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.