/** * Adds data source definitions to RRD definition in bulk. * * @param dsDefs Array of data source definition objects. */ public void addDatasource(DsDef... dsDefs) { for (DsDef dsDef : dsDefs) { addDatasource(dsDef); } }
/** * Adds data source definitions to RRD definition in bulk. * * @param dsDefs Array of data source definition objects. */ public void addDatasource(DsDef... dsDefs) { for (DsDef dsDef : dsDefs) { addDatasource(dsDef); } }
/** * <p>Adds single datasource to RRD definition by specifying its data source name, source type, * heartbeat, minimal and maximal value. For the complete explanation of all data * source definition parameters see RRDTool's * <a href="../../../../man/rrdcreate.html" target="man">rrdcreate man page</a>.</p> * <p><b>IMPORTANT NOTE:</b> If datasource name ends with '!', corresponding archives will never * store NaNs as datasource values. In that case, NaN datasource values will be silently * replaced with zeros by the framework.</p> * * @param dsName Data source name. * @param dsType Data source type. Valid types are "COUNTER", * "GAUGE", "DERIVE" and "ABSOLUTE" (these string constants are conveniently defined in * the {@link org.rrd4j.DsType} class). * @param heartbeat Data source heartbeat. * @param minValue Minimal acceptable value. Use <code>Double.NaN</code> if unknown. * @param maxValue Maximal acceptable value. Use <code>Double.NaN</code> if unknown. * @throws java.lang.IllegalArgumentException Thrown if new datasource definition uses already used data * source name. */ public void addDatasource(String dsName, DsType dsType, long heartbeat, double minValue, double maxValue) { addDatasource(new DsDef(dsName, dsType, heartbeat, minValue, maxValue)); }
/** * <p>Adds single datasource to RRD definition by specifying its data source name, source type, * heartbeat, minimal and maximal value. For the complete explanation of all data * source definition parameters see RRDTool's * <a href="../../../../man/rrdcreate.html" target="man">rrdcreate man page</a>.</p> * * <p><b>IMPORTANT NOTE:</b> If datasource name ends with '!', corresponding archives will never * store NaNs as datasource values. In that case, NaN datasource values will be silently * replaced with zeros by the framework.</p> * * @param dsName Data source name. * @param dsType Data source type. Valid types are "COUNTER", * "GAUGE", "DERIVE" and "ABSOLUTE" (these string constants are conveniently defined in * the {@link DsType} class). * @param heartbeat Data source heartbeat. * @param minValue Minimal acceptable value. Use <code>Double.NaN</code> if unknown. * @param maxValue Maximal acceptable value. Use <code>Double.NaN</code> if unknown. * @throws IllegalArgumentException Thrown if new datasource definition uses already used data * source name. */ public void addDatasource(String dsName, DsType dsType, long heartbeat, double minValue, double maxValue) { addDatasource(new DsDef(dsName, dsType, heartbeat, minValue, maxValue)); }
addDatasource(new DsDef(dsName, dsType, dsHeartbeat, minValue, maxValue));
addDatasource(new DsDef(dsName, dsType, dsHeartbeat, minValue, maxValue));
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.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
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; }
def.addDatasource(dsName, dsType, 90, minValue, maxValue);
rrdDef.addDatasource("requests",DsType.DERIVE,updatePeriodSecs*2,0, Double.NaN); rrdDef.addDatasource("failed", DsType.DERIVE,updatePeriodSecs*2,0, Double.NaN);
rrdDef.addDatasource("exectime",DsType.GAUGE,updatePeriodSecs*2,0, Double.NaN);
rrdDef.setPath(destPath); for (DsDef newDatasource : newDatasources) { rrdDef.addDatasource(newDatasource);
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; }
/** * Creates a new RRD file with one more datasource 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 newDatasources Datasource definitions to be added to the new RRD file * @throws java.io.IOException Thrown in case of I/O error */ public static void addDatasources(String sourcePath, String destPath, Iterable<DsDef> newDatasources) 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); for (DsDef newDatasource : newDatasources) { rrdDef.addDatasource(newDatasource); } try (RrdDb rrdDest = RrdDb.getBuilder().setRrdDef(rrdDef).build()) { rrdSource.copyStateTo(rrdDest); } } }
double min = getChildValueAsDouble(dsNode, "min"); double max = getChildValueAsDouble(dsNode, "max"); rrdDef.addDatasource(name, type, heartbeat, min, max);
rrdDef.addDatasource("a", DsType.GAUGE, 600, Double.NaN, Double.NaN); rrdDef.addArchive(AVERAGE, 0.5, 1, 300); rrdDef.addArchive(MIN, 0.5, 12, 300);
double min = getChildValueAsDouble(dsNode, "min"); double max = getChildValueAsDouble(dsNode, "max"); rrdDef.addDatasource(name, type, heartbeat, min, max);
datasource.getType(), datasource.getHeartbeat(), datasource.getMinValue(), datasource.getMaxValue()); rrdDef.addDatasource(dsDef);
datasource.getType(), datasource.getHeartbeat(), datasource.getMinValue(), datasource.getMaxValue()); rrdDef.addDatasource(dsDef);