resolution doesn't work with Rrd4j

85 views
Skip to first unread message

Maxim Kopeyka

unread,
Feb 2, 2015, 9:52:16 AM2/2/15
to rrd4j-...@googlegroups.com
I'm working with migration from JRobin to Rrd4j and I'm stack with wrong data export from Rrd4j;

JRobin example

RrdExportDef expDef = new RrdExportDef(1420502400, 1422883200);
expDef.datasource(dsName, rrdFile.getAbsolutePath(), dsName, "AVERAGE");
RrdExport exp = new RrdExport(expDef);
ExportData data = exp.fetch(resolution);
data.exportXml(String.format("%s.old.xml", rrdName)); 

Values depend on resolution, I have different values with different resolution

Rrd4j example
 
FetchRequest request = rrddb.createFetchRequest(ARC_TYPE, 1420502400, 1422883200, resolution);
FetchData fetchData = request.fetchData();
fetchData.exportXml(format("d:/temp/%s.xml", path));

Values not depend on resolution, I see the same values with different resolution

Import JRobin to Rrd4j

File rrdXmlFile = File.createTempFile(fileDetails.getFile().getName(), ".xml");
RrdDb rrddb = new RrdDb(fileDetails.getFile().getAbsolutePath());
rrddb.dumpXml(rrdXmlFile.getAbsolutePath());
rrddb.close();
 
org.rrd4j.core.RrdDb mongoRrdDb = new org.rrd4j.core.RrdDb(fileDetails.getRelativePath(), rrdXmlFile.getCanonicalPath(), factory);
mongoRrdDb.close();

Fabrice Bacchella

unread,
Feb 2, 2015, 1:20:38 PM2/2/15
to rrd4j-...@googlegroups.com
You don't compare the same code. Why do you expect the same results ?

RrdExportDef is not any more in jrobin code :

So what do you expect exactly ?


--
You received this message because you are subscribed to the Google Groups "rrd4j-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rrd4j-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maxim Kopeyka

unread,
Feb 2, 2015, 2:18:47 PM2/2/15
to rrd4j-...@googlegroups.com
I expected parameter resolution works somehow, i.e. I should see different values in case I use different resolutions.

Maxim Kopeyka

unread,
Feb 3, 2015, 3:38:39 AM2/3/15
to rrd4j-...@googlegroups.com
I've tested the latest JRobin lib, it doesn't work properly with resolution too.

Maxim Kopeyka

unread,
Feb 3, 2015, 4:35:36 AM2/3/15
to rrd4j-...@googlegroups.com
So, I've tested 3 libraries
  1. JRobin 1.4.0
  2. JRobin 1.5.14
  3. rrd4j
The method createFetchRequest ignores resolution in all these libraries, i.e. I have the same output from all of them.

But JRobin 1.4.0 has RrdExportDef and RrdExport classes and RrdExport doesn't ignore resolution and provides different values for different resolutions
The RrdExport provides correct values even I do this import/export of rrd file:
JRobin 1.4.0 --> rrd4j --> JRobin 1.5.14 --> JRobin 1.4.0

Fabrice Bacchella

unread,
Feb 3, 2015, 7:06:00 AM2/3/15
to rrd4j-...@googlegroups.com

It's explained in the javadoc :

     * Prepares fetch request to be executed on this RRD. Use returned
     * <code>FetchRequest</code> object and its {@link org.rrd4j.core.FetchRequest#fetchData() fetchData()}
     * method to actually fetch data from the RRD file.
     *
     * @param consolFun  Consolidation function to be used in fetch request.
     * @param fetchStart Starting timestamp for fetch request.
     * @param fetchEnd   Ending timestamp for fetch request.
     * @param resolution Fetch resolution (see RRDTool's
     *                   <a href="http://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html" target="man">rrdfetch man page</a> for an
     *                   explanation of this parameter.
     * @return Request object that should be used to actually fetch data from RRD


Maxim Kopeyka

unread,
Feb 3, 2015, 8:12:02 AM2/3/15
to rrd4j-...@googlegroups.com
I've already checked it and create a for loop to see what steps will be returned
for (long resolution = 1; resolution < 1000000; resolution++){
    long endTime = new Long(1422883200/resolution)*resolution;
    long startTime = new Long(1420502400/resolution)*resolution;
    FetchRequest request = rrddb.createFetchRequest(ARC_TYPE, startTime, endTime, resolution);
}

So, I have got these unique steps
  • 300
  • 1800
What should be done on my side to have step=2400 for example?

Fabrice Bacchella

unread,
Feb 3, 2015, 8:32:41 AM2/3/15
to rrd4j-...@googlegroups.com
I'm not sure there is a way to do that.
Reply all
Reply to author
Forward
0 new messages