Skip to content

Using RRDTool's rrd

Fabrice Bacchella edited this page Sep 21, 2022 · 5 revisions

Introduction

Rrdtool unlike rrd4j's rrd are not portable across plateform like Sparc or Intel. However rrd4j can read (but not write) some on them using a included library called jrrd.

The usage is not direct but jrrd can generated org.rrd4j.data.Plottable that can be injected in org.rrd4j.graph.RrdGraphDef or org.rrd4j.data.DataProcessor

An simple Example use could be:

RrdGraphDef gDef = new RrdGraphDef();
gDef.setStartTime(start);
gDef.setEndTime(end);
gDef.setStep(step);

RRDatabase db =  new RRDatabase(rrdpath);
DataChunk dc = db.getData(ConsolidationFunctionType.AVERAGE, start, end, step);
gDef.datasource("ds1", dc.toPlottable("ds1"));

Importing rrdtool's rrd

Rrdtool's files can also be directly imported using the RrdDb builder:

File oldrrd = ...
RrdDb rrd = RrdDb.getBuilder().setPath("imported.rrd").setRrdToolImporter(RrdDb.PREFIX_RRDTool + oldrrd.getPath()).build();