Examples of RrdDb


Examples of org.jrobin.core.RrdDb

 
  public void reset()
  {
    try
    {
      RrdDb rrdDb = _rrdPool.requestRrdDb(_rrdPath);
      Sample sample = rrdDb.createSample();
      sample.setValue("calls", (Integer) _connection.getAttribute(_sessionManger, "callSessions"));
      long totalMemory = __runtime.totalMemory();
      sample.setValue("maxMemory", __runtime.maxMemory());
      sample.setValue("totalMemory", totalMemory);
      sample.setValue("usedMemory", totalMemory - __runtime.freeMemory());
View Full Code Here

Examples of org.jrobin.core.RrdDb

  @SuppressWarnings("unchecked")
  public void updateDb()
  {
    try
    {
      RrdDb rrdDb = _rrdPool.requestRrdDb(_rrdPath);
      Sample sample = rrdDb.createSample();
      if (_connection.isRegistered(_sessionManger))
        sample.setValue("calls", (Integer) _connection.getAttribute(_sessionManger, "callSessions"));
     
      long totalMemory = __runtime.totalMemory();
      sample.setValue("maxMemory", __runtime.maxMemory());
View Full Code Here

Examples of org.jrobin.core.RrdDb

  public byte[] createGraphAsPng(Date start, Date end, RrdGraphDefTemplate graphTemplate)
  {
    try
    {
      RrdDb rrdDb = _rrdPool.requestRrdDb(_rrdPath);
      _rrdPool.release(rrdDb);
      graphTemplate.setVariable("start", start);
      graphTemplate.setVariable("end", end);
      graphTemplate.setVariable("rrd", _rrdPath);
      // create graph finally
View Full Code Here

Examples of org.jrobin.core.RrdDb

        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);
      }
      else
        updateDb();

      RrdDb rrdDb = _rrdPool.requestRrdDb(_rrdPath);
      setRefreshPeriod(rrdDb.getRrdDef().getStep());
      _rrdPool.release(rrdDb);
      _started = true;
    }
    catch (Exception e)
    {
View Full Code Here

Examples of org.jrobin.core.RrdDb

  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.RrdDb

    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.RrdDb

    String[] words = getRemainingWords();
    if (words.length < 3) {
      throw new RrdException("Insufficent number of parameters for rrdupdate command");
    }
    String path = words[1];
    RrdDb rrdDb = getRrdDbReference(path);
    try {
      if (dsNames != null) {
        // template specified, check datasource names
        for (String dsName : dsNames) {
          if (!rrdDb.containsDs(dsName)) {
            throw new RrdException("Invalid datasource name: " + dsName);
          }
        }
      }
      // parse update strings
      long timestamp = -1;
      for (int i = 2; i < words.length; i++) {
        String[] tokens = new ColonSplitter(words[i]).split();
        if (dsNames != null && dsNames.length + 1 != tokens.length) {
          throw new RrdException("Template requires " + dsNames.length + " values, " +
              (tokens.length - 1) + " value(s) found in: " + words[i]);
        }
        int dsCount = rrdDb.getHeader().getDsCount();
        if (dsNames == null && dsCount + 1 != tokens.length) {
          throw new RrdException("Expected " + dsCount + " values, " +
              (tokens.length - 1) + " value(s) found in: " + words[i]);
        }
        timestamp = Util.getTimestamp(tokens[0]);
        Sample sample = rrdDb.createSample(timestamp);
        for (int j = 1; j < tokens.length; j++) {
          if (dsNames == null) {
            sample.setValue(j - 1, parseDouble(tokens[j]));
          }
          else {
View Full Code Here

Examples of org.jrobin.core.RrdDb

      File rrdFile = new File(path);
      print(countFormatter.format(totalCount) + "/" + countFormatter.format(files.length) +
          " " + rrdFile.getName() + " ");
      String sourcePath = rrdFile.getCanonicalPath();
      String destPath = sourcePath + SUFFIX;
      RrdDb rrd = new RrdDb(destPath, RrdDb.PREFIX_RRDTool + sourcePath);
      rrd.close();
      goodCount++;
      double seconds = (System.currentTimeMillis() - start) / 1000.0;
      println("[OK, " + secondsFormatter.format(seconds) + " sec]");
    }
    catch (Exception e) {
View Full Code Here

Examples of org.jrobin.core.RrdDb

    if (dsIndex != newDsIndex) {
      dsIndex = newDsIndex;
      values = null;
      if (dsIndex >= 0) {
        try {
          RrdDb rrd = new RrdDb(file.getAbsolutePath(), true);
          try {
            Datasource ds = rrd.getDatasource(dsIndex);
            values = new Object[] {
                ds.getDsName(),
                ds.getDsType(),
                "" + ds.getHeartbeat(),
                InspectorModel.formatDouble(ds.getMinValue()),
                InspectorModel.formatDouble(ds.getMaxValue()),
                InspectorModel.formatDouble(ds.getLastValue()),
                InspectorModel.formatDouble(ds.getAccumValue()),
                "" + ds.getNanSeconds()
            };
          }
          finally {
            rrd.close();
          }
        }
        catch (IOException e) {
          Util.error(null, e);
        }
View Full Code Here

Examples of org.jrobin.core.RrdDb

    String[] words = getRemainingWords();
    if (words.length != 2) {
      throw new RrdException("Invalid rrdlast syntax");
    }
    String path = words[1];
    RrdDb rrdDb = getRrdDbReference(path);
    try {
      long lastUpdateTime = rrdDb.getLastUpdateTime();
      println(lastUpdateTime + "");
      return lastUpdateTime;
    }
    finally {
      releaseRrdDbReference(rrdDb);
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.