Examples of RrdDef


Examples of org.jrobin.core.RrdDef

        RrdDefTemplate defTemplate = new RrdDefTemplate(new InputSource(templateIs));

        defTemplate.setVariable("path", _rrdPath);
        defTemplate.setVariable("start", new Date(System.currentTimeMillis()));
        RrdDef rrdDef = defTemplate.getRrdDef();

        RrdDb rrdDb = _rrdPool.requestRrdDb(rrdDef);
        rrdDb.getRrdDef().getStep();
        _rrdPool.release(rrdDb);
      }
View Full Code Here

Examples of org.jrobin.core.RrdDef

    }
  }
 
  @Before
  public void setUp() throws Exception {
    RrdDef def = new RrdDef("target/test.jrb");
    def.setStep(300);
    def.addDatasource("test", "GAUGE", 300L, Double.NaN, Double.NaN);
    def.addArchive("RRA:AVERAGE:0.5:1:2016");
    m_db = new RrdDb(def);
  }
View Full Code Here

Examples of org.jrobin.core.RrdDef

    // Create a simple JRB file called test-graph-cmd with an RRA called
    // "testvalue" (AVERAGE). Enough to generate graphs using RrdGraphCmd.
    // Note we're not testing the graphing itself, just the parsing
    this.jrbFileName = "target/test-graph-cmd.jrb";
    RrdDef def = new RrdDef(this.jrbFileName);
    def.setStartTime(1000);
    def.setStep(1);
    def.addDatasource("testvalue", "GAUGE", 2, Double.NaN, Double.NaN);
    def.addArchive("RRA:AVERAGE:0.5:1:100");
    RrdDb rrd = new RrdDb(def);
    rrd.close();

    this.graphCmd = new RrdGraphCmd();
   
View Full Code Here

Examples of org.jrobin.core.RrdDef

    String[] words = getRemainingWords();
    if (words.length < 2) {
      throw new RrdException("RRD file path not specified");
    }
    String path = words[1];
    rrdDef = new RrdDef(path, start, step);
    for (int i = 2; i < words.length; i++) {
      if (words[i].startsWith("DS:")) {
        parseDef(words[i]);
      }
      else if (words[i].startsWith("RRA:")) {
View Full Code Here

Examples of org.jrobin.core.RrdDef

        // check if the rrd exists
        if (!RrdSqlBackend.exists(def[0].getDbPath())) {
            RrdDb db = null;
            try {
                RrdDef rrdDef = new RrdDef(def[0].getDbPath(), STAT_RESOULUTION);
                for (StatDefinition stat : def) {
                    String dsType = determineDsType(stat.getStatistic().getStatType());
                    rrdDef.addDatasource(stat.getDatasourceName(), dsType, 5 * STAT_RESOULUTION, 0,
                            Double.NaN);
                }

                // Every minute for 1 hour.
                rrdDef.addArchive(((DefaultStatDefinition) def[0]).
                        consolidationFunction, 0.5, 1, 60);
                // Every half-hour for 1 day.
                rrdDef.addArchive(ConsolFuns.CF_AVERAGE, 0.5, 30, 48);
                // Every day for 5 years.
                rrdDef.addArchive(ConsolFuns.CF_AVERAGE, 0.5, 1440, 1825);
                // Every week for 5 years.
                rrdDef.addArchive(ConsolFuns.CF_AVERAGE, 0.5, 10080, 260);
                // Every month for 5 years.
                rrdDef.addArchive(ConsolFuns.CF_AVERAGE, 0.5, 43200, 60);

                db = new RrdDb(rrdDef);
            }
            finally {
                if(db != null) {
View Full Code Here

Examples of org.jrobin.core.RrdDef

    String[] words = getRemainingWords();
    if (words.length < 2) {
      throw new RrdException("RRD file path not specified");
    }
    String path = words[1];
    rrdDef = new RrdDef(path, start, step);
    for (int i = 2; i < words.length; i++) {
      if (words[i].startsWith("DS:")) {
        parseDef(words[i]);
      }
      else if (words[i].startsWith("RRA:")) {
View Full Code Here

Examples of org.jrobin.core.RrdDef

    return result;
  }

  public void doWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {
    RrdDef def = getDatabaseTemplateSpec();

    List<String> dsNames = getDsNames(def.getDsDefs());

    Map<String, String> dataMap = new TreeMap<String, String>();

    // go over all the results and look for datasource names that map to
    // keys from the result values
View Full Code Here

Examples of org.jrobin.core.RrdDef

   * be returned in r/w mode.
   */
  protected RrdDef getDatabaseTemplateSpec() throws Exception {
    RrdDefTemplate t = new RrdDefTemplate(templateFile);
    t.setVariable("database", this.outputFile.getCanonicalPath());
    RrdDef def = t.getRrdDef();
    if (!this.outputFile.exists()) {
      FileUtils.forceMkdir(this.outputFile.getParentFile());
      rrdToolCreateDatabase(def);
    }
    return def;
View Full Code Here

Examples of org.jrobin.core.RrdDef

    RrdDb result;
    if (!this.outputFile.exists()) {
      FileUtils.forceMkdir(this.outputFile.getParentFile());
      RrdDefTemplate t = new RrdDefTemplate(this.templateFile);
      t.setVariable("database", this.outputFile.getCanonicalPath());
      RrdDef def = t.getRrdDef();
      result = new RrdDb(def);
    } else {
      result = new RrdDb(this.outputFile.getCanonicalPath());
    }
    return result;
View Full Code Here

Examples of org.rrd4j.core.RrdDef

   * @param path
   * @throws IOException
   */
  public RoundRobin(long heartbeat, File path) throws IOException {
    if (path == null ) path = MFile.createTempFile(MSystem.getPid(), "rrd");
    RrdDef rrdDef = new RrdDef(path.getAbsolutePath());
    rrdDef.setStartTime(System.currentTimeMillis());
    rrdDef.addDatasource("speed", DsType.COUNTER, heartbeat, Double.NaN, Double.NaN);
    rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 1, 24);
    rrdDef.addArchive(ConsolFun.AVERAGE, 0.5, 6, 10);
    // RrdBackendFactory factory = RrdBackendFactory.getFactory("MEMORY");
    rrdDb = new RrdDb(rrdDef);
    sample = rrdDb.createSample();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.