Consolidation on the fly with DataProccessor from lower resolution

36 views
Skip to first unread message

Jexino

unread,
Feb 5, 2017, 10:33:28 AM2/5/17
to rrd4j-discuss
Hello,

I tried to consolidate data with a resolution of 900 seconds to a day with ConsolFun LAST using DataProccessor, but the consolidations seems to be calculated incorrectly with AVERAGE!?
The consolidated values are slightly different

Expected:
1483747200  +3.9630112000E07
1483833600  +3.9655773000E07
1483902000  +3.9681433000E07

but delivered is:
1483747200  +3.9630112000E07
1483833600  +3.9642014155E07
1483920000  +3.9667075774E07

Can someone help me? (Thanks in advance)


Here is my using test code and the rrd file is attached...

import java.io.File;
import java.io.IOException;
import java.util.*;

import org.rrd4j.core.*;
import org.rrd4j.ConsolFun;
import org.rrd4j.data.*;

class DataProcessorDemo {

    public static void main(String[] args) throws IOException {
        // time span
        long t1 = Util.getTimestamp(2017, 0, 7);
        long t2 = Util.getTimestamp(2017, 0, 9);
        System.out.println("t1 = " + t1);
        System.out.println("t2 = " + t2);

        // RRD file to use
        String rrdPath = "testdb.rrd";

        // constructor
        DataProcessor dp = new DataProcessor(t1, t2);
        dp.setFetchRequestResolution(86400);
        dp.setStep(86400);

        // datasource definitions
        dp.addDatasource("X", rrdPath, "CNT_MET_TotWhOut", ConsolFun.LAST);
       
        // action
        long laptime = System.currentTimeMillis();
        dp.processData();
        System.out.println("Data processed in " + (System.currentTimeMillis() - laptime) + " milliseconds\n---");
        System.out.println(dp.dump());
    }
}
testdb.rrd

Jexino

unread,
Feb 8, 2017, 5:08:41 PM2/8/17
to rrd4j-discuss
Hello again...

I will explain it to make it a little clearer. 
rrd4j internally works only in UTC, so a day consolidation is always in UTC aligned. BUT for presentation it looks rather odd, when daily averages are not aligned to the local time of a day.
So my idea was to store hourly data in a RRA, and then build daily averages for localtime days on the fly over DataProcessor.

Has anyone else that problem? Are there any other possibilities? I will aggregate values for a day with localtime and not UTC even for DST issue!

Thanx
Jexino

Reply all
Reply to author
Forward
0 new messages