/** * Adds archive definitions to RRD definition in bulk. * * @param arcDefs Array of archive definition objects * @throws java.lang.IllegalArgumentException Thrown if RRD definition already contains archive with * the same consolidation function and the same number of steps. */ public void addArchive(ArcDef... arcDefs) { for (ArcDef arcDef : arcDefs) { addArchive(arcDef); } }
/** * Adds archive definitions to RRD definition in bulk. * * @param arcDefs Array of archive definition objects * @throws IllegalArgumentException Thrown if RRD definition already contains archive with * the same consolidation function and the same number of steps. */ public void addArchive(ArcDef... arcDefs) { for (ArcDef arcDef : arcDefs) { addArchive(arcDef); } }
/** * Adds single archive definition by specifying its consolidation function, X-files factor, * number of steps and rows. For the complete explanation of all archive * definition parameters see RRDTool's * <a href="../../../../man/rrdcreate.html" target="man">rrdcreate man page</a>. * * @param consolFun Consolidation function. * @param xff X-files factor. Valid values are between 0 and 1. * @param steps Number of archive steps * @param rows Number of archive rows * @throws java.lang.IllegalArgumentException Thrown if archive with the same consolidation function * and the same number of steps is already added. */ public void addArchive(ConsolFun consolFun, double xff, int steps, int rows) { addArchive(new ArcDef(consolFun, xff, steps, rows)); }
/** * Adds single archive definition by specifying its consolidation function, X-files factor, * number of steps and rows. For the complete explanation of all archive * definition parameters see RRDTool's * <a href="../../../../man/rrdcreate.html" target="man">rrdcreate man page</a>.</p> * * @param consolFun Consolidation function. * @param xff X-files factor. Valid values are between 0 and 1. * @param steps Number of archive steps * @param rows Number of archive rows * @throws IllegalArgumentException Thrown if archive with the same consolidation function * and the same number of steps is already added. */ public void addArchive(ConsolFun consolFun, double xff, int steps, int rows) { addArchive(new ArcDef(consolFun, xff, steps, rows)); }
stCfg.setStep(SAMPLE_INTERVAL); stCfg.addDatasource("triples", DsType.COUNTER, 600, Double.NaN, Double.NaN); stCfg.addArchive(ConsolFun.AVERAGE, 0.5, 1, 1440); // every five seconds for 2 hours stCfg.addArchive(ConsolFun.AVERAGE, 0.5, 12, 1440); // every minute for 1 day stCfg.addArchive(ConsolFun.AVERAGE, 0.5, 60, 1440); // every five minutes for five days
throw illArgException; addArchive(new ArcDef(consolFun, xff, steps, rows));
throw illArgException; addArchive(new ArcDef(consolFun, xff, steps, rows));
stCfg.setStep(SAMPLE_INTERVAL); stCfg.addDatasource("triples", DsType.COUNTER, 600, Double.NaN, Double.NaN); stCfg.addArchive(ConsolFun.AVERAGE, 0.5, 1, 1440); // every five seconds for 2 hours stCfg.addArchive(ConsolFun.AVERAGE, 0.5, 12, 1440); // every minute for 1 day stCfg.addArchive(ConsolFun.AVERAGE, 0.5, 60, 1440); // every five minutes for five days
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, 1, samplesPerOur); rrdDef.addArchive(ConsolFun.MIN, 0.5d, 1, samplesPerOur); rrdDef.addArchive(ConsolFun.MAX, 0.5d, 1, samplesPerOur); rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, samplesPerTenMin, tenMinSamplesPer100Hours); rrdDef.addArchive(ConsolFun.MIN, 0.5d, samplesPerTenMin, tenMinSamplesPer100Hours); rrdDef.addArchive(ConsolFun.MAX, 0.5d, samplesPerTenMin, tenMinSamplesPer100Hours); rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, samplesPerOur, hourSamplesPerMonth); rrdDef.addArchive(ConsolFun.MIN, 0.5d, samplesPerOur, hourSamplesPerMonth); rrdDef.addArchive(ConsolFun.MAX, 0.5d, samplesPerOur, hourSamplesPerMonth); rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, samplesPerDay, daySamplesPer2Years); rrdDef.addArchive(ConsolFun.MIN, 0.5d, samplesPerDay, daySamplesPer2Years); rrdDef.addArchive(ConsolFun.MAX, 0.5d, samplesPerDay, daySamplesPer2Years);
rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, 1, samplesPerOur); rrdDef.addArchive(ConsolFun.MIN, 0.5d, 1, samplesPerOur); rrdDef.addArchive(ConsolFun.MAX, 0.5d, 1, samplesPerOur); rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, samplesPerTenMin, tenMinSamplesPer100Hours); rrdDef.addArchive(ConsolFun.MIN, 0.5d, samplesPerTenMin, tenMinSamplesPer100Hours); rrdDef.addArchive(ConsolFun.MAX, 0.5d, samplesPerTenMin, tenMinSamplesPer100Hours); rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, samplesPerOur, hourSamplesPerMonth); rrdDef.addArchive(ConsolFun.MIN, 0.5d, samplesPerOur, hourSamplesPerMonth); rrdDef.addArchive(ConsolFun.MAX, 0.5d, samplesPerOur, hourSamplesPerMonth); rrdDef.addArchive(ConsolFun.AVERAGE, 0.5d, samplesPerDay, daySamplesPer2Years); rrdDef.addArchive(ConsolFun.MIN, 0.5d, samplesPerDay, daySamplesPer2Years); rrdDef.addArchive(ConsolFun.MAX, 0.5d, samplesPerDay, daySamplesPer2Years);
def.addArchive(ConsolFun.TOTAL, DEFAULT_XFF_FACTOR, 1, 60); def.addArchive(ConsolFun.TOTAL, DEFAULT_XFF_FACTOR, 15, ONE_YEAR_IN_15_MINUTE_STEPS); def.addArchive(ConsolFun.AVERAGE, DEFAULT_XFF_FACTOR, 1, 60); def.addArchive(ConsolFun.AVERAGE, DEFAULT_XFF_FACTOR, 15, ONE_YEAR_IN_15_MINUTE_STEPS); def.addArchive(ConsolFun.MAX, DEFAULT_XFF_FACTOR, 1, 60); def.addArchive(ConsolFun.MAX, DEFAULT_XFF_FACTOR, 15, ONE_YEAR_IN_15_MINUTE_STEPS); def.addArchive(ConsolFun.MIN, DEFAULT_XFF_FACTOR, 1, 60); def.addArchive(ConsolFun.MIN, DEFAULT_XFF_FACTOR, 15, ONE_YEAR_IN_15_MINUTE_STEPS);
public RrdDef getRrdDef(ArchivesSet archives) { RrdDef def = new RrdDef(getPath()); def.setVersion(2); def.addDatasource(getDsDefs()); def.addArchive(archives.getArchives()); def.setStep(p.getStep()); return def; }
rrdDef.addArchive(AVERAGE, 0.5, 1, 300); rrdDef.addArchive(MIN, 0.5, 12, 300); rrdDef.addArchive(MAX, 0.5, 12, 300); RrdDb rrdDb = new RrdDb(rrdDef);
/** * Creates a new RRD file with one more archive in it. RRD file is created based on the * existing one (the original RRD file is not modified at all). All data from * the original RRD file is copied to the new one. * * @param sourcePath path to a RRD file to import data from (will not be modified) * @param destPath path to a new RRD file (will be created) * @param newArchive Archive definition to be added to the new RRD file * @throws IOException Thrown in case of I/O error */ public static void addArchive(String sourcePath, String destPath, ArcDef newArchive) throws IOException { if (Util.sameFilePath(sourcePath, destPath)) { throw new IllegalArgumentException("Source and destination paths are the same"); } RrdDb rrdSource = new RrdDb(sourcePath); try { RrdDef rrdDef = rrdSource.getRrdDef(); rrdDef.setPath(destPath); rrdDef.addArchive(newArchive); RrdDb rrdDest = new RrdDb(rrdDef); try { rrdSource.copyStateTo(rrdDest); } finally { rrdDest.close(); } } finally { rrdSource.close(); } }
/** * Creates a new RRD file with one more archive in it. RRD file is created based on the * existing one (the original RRD file is not modified at all). All data from * the original RRD file is copied to the new one. * * @param sourcePath path to a RRD file to import data from (will not be modified) * @param destPath path to a new RRD file (will be created) * @param newArchive Archive definition to be added to the new RRD file * @throws java.io.IOException Thrown in case of I/O error */ public static void addArchive(String sourcePath, String destPath, ArcDef newArchive) throws IOException { if (Util.sameFilePath(sourcePath, destPath)) { throw new IllegalArgumentException(SOURCE_AND_DESTINATION_PATHS_ARE_THE_SAME); } try (RrdDb rrdSource = RrdDb.getBuilder().setPath(sourcePath).build()) { RrdDef rrdDef = rrdSource.getRrdDef(); rrdDef.setPath(destPath); rrdDef.addArchive(newArchive); try (RrdDb rrdDest = RrdDb.getBuilder().setRrdDef(rrdDef).build()) { rrdSource.copyStateTo(rrdDest); } } }
protected RrdDef createDef() { final RrdDef rrdDef; if (step != null) { if (startTime != null) { if (version != null) rrdDef = new RrdDef(resolvedPath, startTime, step, version); else rrdDef = new RrdDef(resolvedPath, startTime, step); } else rrdDef = new RrdDef(resolvedPath, step); } else rrdDef = new RrdDef(resolvedPath); if (archives != null) for (RrdArchive archive : archives) rrdDef.addArchive(archive.getDef()); if (datasources != null) for (RrdDataSource datasource : datasources) rrdDef.addDatasource(datasource.getDef()); rrdDef.addDatasource(); return rrdDef; }
int steps = getChildValueAsInt(arcNode, "steps"); int rows = getChildValueAsInt(arcNode, "rows"); rrdDef.addArchive(consolFun, xff, steps, rows);
int steps = getChildValueAsInt(arcNode, "steps"); int rows = getChildValueAsInt(arcNode, "rows"); rrdDef.addArchive(consolFun, xff, steps, rows);
ArcDef arcDef = new ArcDef(archive.getConsolFun(), archive.getXff(), archive.getSteps(), archive.getRows()); rrdDef.addArchive(arcDef);
ArcDef arcDef = new ArcDef(archive.getConsolFun(), archive.getXff(), archive.getSteps(), archive.getRows()); rrdDef.addArchive(arcDef);