We use RRD-Tool as part of our company products. The problem is that each RRD file requires a heartbeat which tracks the timeframe in which an value can be populated. Based on how you're describing it, RRD will already have a value populated on a certain epoch time. The second data point cannot be insert into it because the RRD file already has an entry within that heartbeat time frame.

You will need to insert both values (in and out) at the same time.

I recommend that you create a hash that contains both the in and out values, then loop through the hash. My example is showing this without the RRDTool::OO module. But I'm giving you a conceptual way to do it.

use RRDs; ## FORMAT IN::OUT VALUES $rrdFile{'foo.rrd'} = "323::460"; $rrdFile{'bar.rrd'} = "322::110"; $RrdEpochTime = time(); foreach (keys (%rrdFile)) { ($in, $out) = split (/::/, $rrdFile{$_}); RRDs::update("$_","$RrdEpochTime:$in:$out"); }

The goal here is to assemble a hash that contains your data, then loop once to store it in RRD.

This should help get your gears moving. I've had to use this method before when polling a large amount of SNMP data.


In reply to Re: rrdtool:oo two separate datasets by FitTrend
in thread rrdtool:oo two separate datasets by bengmau

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.