Sample(RrdDb parentDb, long time) throws IOException { this.parentDb = parentDb; this.time = time; this.dsNames = parentDb.getDsNames(); values = new double[dsNames.length]; clearValues(); }
Sample(RrdDb parentDb, long time) throws IOException { this.parentDb = parentDb; this.time = time; this.dsNames = parentDb.getDsNames(); values = new double[dsNames.length]; clearValues(); }
public Map<String, Number> getLastValues() { Map<String, Number> retValues = new HashMap<String, Number>(); RrdDb rrdDb = null; try { rrdDb = factory.getRrd(getPath()); String[] dsNames = rrdDb.getDsNames(); for(int i = 0; i < dsNames.length; i++) { retValues.put(dsNames[i], rrdDb.getDatasource(i).getLastValue()); } } catch (Exception e) { log(Level.ERROR, e, "Unable to get last values: %s", e.getMessage()); } finally { if(rrdDb != null) factory.releaseRrd(rrdDb); } return retValues; }
FetchData(Archive matchingArchive, FetchRequest request) throws IOException { this.matchingArchive = matchingArchive; this.arcStep = matchingArchive.getArcStep(); this.arcEndTime = matchingArchive.getEndTime(); this.dsNames = request.getFilter(); if (this.dsNames == null) { this.dsNames = matchingArchive.getParentDb().getDsNames(); } this.request = request; }
FetchData(Archive matchingArchive, FetchRequest request) throws IOException { this.matchingArchive = matchingArchive; this.arcStep = matchingArchive.getArcStep(); this.arcEndTime = matchingArchive.getEndTime(); this.dsNames = request.getFilter(); if (this.dsNames == null) { this.dsNames = matchingArchive.getParentDb().getDsNames(); } this.request = request; }
this)); rrdNode.getChildren().add(consolFunNode); for (String ds : rrd.getDsNames()) { consolFunNode.getChildren().add(new TreeItem<>(new TimeSeriesBinding<>( ds,
String[] dsToFetch = request.getFilter(); if (dsToFetch == null) { dsToFetch = parentDb.getDsNames();
/** * Splits single RRD file with several datasources into a number of smaller RRD files * with a single datasource in it. All archived values are preserved. If * you have a RRD file named 'traffic.rrd' with two datasources, 'in' and 'out', this * method will create two files (with a single datasource, in the same directory) * named 'in-traffic.rrd' and 'out-traffic.rrd'. * * @param sourcePath Path to a RRD file with multiple datasources defined * @throws IOException Thrown in case of I/O error */ public static void split(String sourcePath) throws IOException { RrdDb rrdSource = new RrdDb(sourcePath); try { String[] dsNames = rrdSource.getDsNames(); for (String dsName : dsNames) { RrdDef rrdDef = rrdSource.getRrdDef(); rrdDef.setPath(createSplitPath(dsName, sourcePath)); rrdDef.saveSingleDatasource(dsName); RrdDb rrdDest = new RrdDb(rrdDef); try { rrdSource.copyStateTo(rrdDest); } finally { rrdDest.close(); } } } finally { rrdSource.close(); } }
String[] dsToFetch = request.getFilter(); if (dsToFetch == null) { dsToFetch = parentDb.getDsNames();
/** * Splits single RRD file with several datasources into a number of smaller RRD files * with a single datasource in it. All archived values are preserved. If * you have a RRD file named 'traffic.rrd' with two datasources, 'in' and 'out', this * method will create two files (with a single datasource, in the same directory) * named 'in-traffic.rrd' and 'out-traffic.rrd'. * * @param sourcePath Path to a RRD file with multiple datasources defined * @throws java.io.IOException Thrown in case of I/O error */ public static void split(String sourcePath) throws IOException { try (RrdDb rrdSource = RrdDb.getBuilder().setPath(sourcePath).build()) { String[] dsNames = rrdSource.getDsNames(); for (String dsName : dsNames) { RrdDef rrdDef = rrdSource.getRrdDef(); rrdDef.setPath(createSplitPath(dsName, sourcePath)); rrdDef.saveSingleDatasource(dsName); try (RrdDb rrdDest = RrdDb.getBuilder().setRrdDef(rrdDef).build()) { rrdSource.copyStateTo(rrdDest); } } } }