/** * Adds single archive definition represented with object of class <code>ArcDef</code>. * * @param arcDef Archive definition. * @throws java.lang.IllegalArgumentException Thrown if archive with the same consolidation function * and the same number of steps is already added. */ public void addArchive(ArcDef arcDef) { if (arcDefs.contains(arcDef)) { throw new IllegalArgumentException("Archive already defined: " + arcDef.dump()); } arcDefs.add(arcDef); }
/** * Adds single archive definition represented with object of class <code>ArcDef</code>. * * @param arcDef Archive definition. * @throws IllegalArgumentException Thrown if archive with the same consolidation function * and the same number of steps is already added. */ public void addArchive(ArcDef arcDef) { if (arcDefs.contains(arcDef)) { throw new IllegalArgumentException("Archive already defined: " + arcDef.dump()); } arcDefs.add(arcDef); }
public void addArchive(ArcDef arcDef) { add(arcDef); logger.trace(Util.delayedFormatString("Adding archive: %s", arcDef.dump())); }
RrdNode(RrdDb rrd, int dsIndex, int arcIndex) throws IOException { // archive node this.dsIndex = dsIndex; this.arcIndex = arcIndex; ArcDef[] arcDefs = rrd.getRrdDef().getArcDefs(); label = arcDefs[arcIndex].dump(); }
/** * Returns string that represents all specified RRD creation parameters. Returned string * has the syntax of RRDTool's <code>create</code> command. * * @return Dumped content of <code>RrdDb</code> object. */ public String dump() { StringBuilder sb = new StringBuilder("create \""); sb.append(path).append("\""); sb.append(" --version ").append(getVersion()); sb.append(" --start ").append(getStartTime()); sb.append(" --step ").append(getStep()).append(" "); for (DsDef dsDef : dsDefs) { sb.append(dsDef.dump()).append(" "); } for (ArcDef arcDef : arcDefs) { sb.append(arcDef.dump()).append(" "); } return sb.toString().trim(); }
/** * Returns string that represents all specified RRD creation parameters. Returned string * has the syntax of RRDTool's <code>create</code> command. * * @return Dumped content of <code>RrdDb</code> object. */ public String dump() { StringBuilder sb = new StringBuilder("create \""); sb.append(uri) .append("\"") .append(" --version ").append(getVersion()) .append(" --start ").append(getStartTime()) .append(" --step ").append(getStep()).append(" "); for (DsDef dsDef : dsDefs) { sb.append(dsDef.dump()).append(" "); } for (ArcDef arcDef : arcDefs) { sb.append(arcDef.dump()).append(" "); } return sb.toString().trim(); }
private void fillGraphCombo() { try { RrdDb rrdDb = new RrdDb(sourcePath, true); try { RrdDef rrdDef = rrdDb.getRrdDef(); final DsDef[] dsDefs = rrdDef.getDsDefs(); final ArcDef[] arcDefs = rrdDef.getArcDefs(); GraphComboItem[] items = new GraphComboItem[rrdDef.getDsCount() * rrdDef.getArcCount()]; int selectedItem = -1; for (int i = 0, k = 0; i < rrdDef.getDsCount(); i++) { for (int j = 0; j < rrdDef.getArcCount(); k++, j++) { String description = dsDefs[i].dump() + " " + arcDefs[j].dump(); items[k] = new GraphComboItem(description, i, j); if (i == dsIndex && j == arcIndex) { selectedItem = k; } } } graphCombo.setModel(new DefaultComboBoxModel(items)); graphCombo.setSelectedIndex(selectedItem); } finally { rrdDb.close(); } } catch (Exception e) { Util.error(this, e); } }
rrdGraphDef.setImageFormat("png"); rrdGraphDef.setTitle(rrdDef.getDsDefs()[dsIndex].dump() + " " + rrdDef.getArcDefs()[arcIndex].dump()); LinearInterpolator linearInterpolator = new LinearInterpolator(timestamps, values); linearInterpolator.setInterpolationMethod(LinearInterpolator.INTERPOLATE_RIGHT);