Search code examples
xmlexportrowsrrdtool

Maxrows in rrdtool xport


I would like to export my rrd with all data from the last year with a 10 minute step between. My rrd file is updated every 1 minute with data. This is my code to xport:

rrdtool xport --start now-1y --end now --step 600 --maxrows 219000 \
       DEF:AverageIn="values.rrd":in:AVERAGE \
       DEF:AverageOut="values.rrd":out:AVERAGE \
       XPORT:AverageIn:'RX verdi' \
       XPORT:AverageOut:'TX verdi' > exported.xml";

After reading the documentation i needed to set --maxrows to make this happen because the default maxrow is 300(5 mins). My calculation of the maxrow: 600 sec(10 min) * 365 days(the last 1 year i wanted) = 219000

But this is my resulting xml:

<xport>
  <meta>
    <start>1421331840</start>
    <step>17280</step>
    <end>1452850560</end>
    <rows>1825</rows>
    <columns>2</columns>
    <legend>
      <entry>RX verdi</entry>
      <entry>TX verdi</entry>
    </legend>
  </meta>
  <data>
    <row><t>1421331840</t><v>NaN</v><v>NaN</v></row>
    <row><t>1421349120</t><v>NaN</v><v>NaN</v></row>

My rrdtool create code:

rrdtool create $rrdsignal --step 60 --start now \
            DS:in:GAUGE:600:U:U \
            DS:out:GAUGE:600:U:U \
            RRA:AVERAGE:0.5:1:2880 \
            RRA:AVERAGE:0.5:1:2880 \
            RRA:AVERAGE:0.5:6:700 \
            RRA:AVERAGE:0.5:6:700 \
            RRA:AVERAGE:0.5:24:775 \
            RRA:AVERAGE:0.5:144:1500 \
            RRA:AVERAGE:0.5:288:2000 \
            RRA:MIN:0.5:1:600 \
            RRA:MIN:0.5:6:700 \
            RRA:MIN:0.5:24:775 \
            RRA:MIN:0.5:144:1500 \
            RRA:MIN:0.5:288:2000 \
            RRA:MAX:0.5:6:700 \
            RRA:MAX:0.5:24:775 \
            RRA:MAX:0.5:144:1500 \
            RRA:MAX:0.5:288:2000"

How can I decrease the steps and increase the rows in this example? Please comment if something was unclear.

EDIT: Added rrd create code


Solution

  • You can't do it, and the reason is because you do not have the data any more. The reason for this is the way you have defined your RRAs.

    My first question is why you have defined two pairs of identical RRAs:

            RRA:AVERAGE:0.5:1:2880 \
            RRA:AVERAGE:0.5:1:2880 \
            RRA:AVERAGE:0.5:6:700 \
            RRA:AVERAGE:0.5:6:700 \
    

    There is no need to store the same thing twice.

    The next part is because you do not seem to understand how the RRDTool database works.

    When you store a value in RRDTool, it is normalised into the Step of the RRD (in this case, the Step is 1 minute). Now, it is stored into all of the defined RRAs, using the specified consolodation function, and combining it with the specified number of other samples to make that RRA.

    So, in your case, you have one RRA that stores the value (the number of samples is 1 and the RRA interval is therefore 1 minute), another that combines it with 5 others ( the number of samples is 6 and the RRA interval is therefore 6min ), another with a 24minute, andother with 144minute, and so on. I strongly suspect that you have misdefined these RRAs and you either intended a 10min step, or needed the number of combined samples to be 10x larger!

    When you ask for a year's set of 10min interval data, RRDtool looks at the available RRAs, and finds that the only one longe enough to provide a year's data is the last one -- 288 min RRA interval, with 2000 rows (IE 400 days). Therefore it uses this one. You could force it to output the step you want, but it would approximate it from this RRA as there is no 10min RRA available, and there is no other RRA long enough to cover the whole year.

    Even if you were using a 10min step, your first 10min RRA would only have a length of 10min x 2880 = 20 days.

    I would suggest you do the following:

    • Change your create to remove the two duplicated RRAs
    • Either change your step to be 10min (600) or else increase the intervals of your RRAs by a factor of 10 (to become 10, 60, 240 etc). Which of these you choose to do will depend on the frequency your data arrive - the main interval (currently 60s) should correspond to the data frequency.
    • Increase the length of your 10min RRA to be a full year. This would make it length of at least 52704 instead of the current 2880. You may also wish to extend some of the other RRA depending on what graphs and extracts you require.

    HTH