Package org.jrobin.core

Examples of org.jrobin.core.Datasource


      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();
          }
View Full Code Here


    RrdDb rrdDb = getRrdDbReference(rrdPath, xmlPath);
    try {
      if (check) {
        int dsCount = rrdDb.getHeader().getDsCount();
        for (int i = 0; i < dsCount; i++) {
          Datasource ds = rrdDb.getDatasource(i);
          double minValue = ds.getMinValue();
          double maxValue = ds.getMaxValue();
          // this will perform range check
          ds.setMinMaxValue(minValue, maxValue, true);
        }
      }
      return rrdPath;
    }
    finally {
View Full Code Here

    b.append("filename = \"").append(rrd.getPath()).append("\"\n");
    b.append("rrd_version = \"0001\"\n");
    b.append("step = ").append(rrd.getHeader().getStep()).append("\n");
    b.append("last_update = ").append(rrd.getHeader().getLastUpdateTime()).append("\n");
    for (int i = 0; i < rrd.getDsCount(); i++) {
      Datasource ds = rrd.getDatasource(i);
      b.append("ds[").append(ds.getDsName()).append("].type = \"").append(ds.getDsType()).append("\"\n");
      b.append("ds[").append(ds.getDsName()).append("].minimal_heartbeat = ").
          append(ds.getHeartbeat()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].min = ").append(ds.getMinValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].max = ").append(ds.getMaxValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].last_ds = ").append(ds.getLastValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].value = ").append(ds.getAccumValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].unknown_sec = ").append(ds.getNanSeconds()).append("\n");
    }
    for (int i = 0; i < rrd.getArcCount(); i++) {
      Archive arc = rrd.getArchive(i);
      b.append("rra[").append(i).append("].cf = \"").append(arc.getConsolFun()).append("\"\n");
      b.append("rra[").append(i).append("].rows = ").append(arc.getRows()).append("\n");
View Full Code Here

    if (tokens.length != 2) {
      throw new RrdException("Invalid suntax in: " + heartbeatStr);
    }
    String dsName = tokens[0];
    long heartbeat = Long.parseLong(tokens[1]);
    Datasource ds = rrd.getDatasource(dsName);
    ds.setHeartbeat(heartbeat);
  }
View Full Code Here

    if (tokens.length != 2) {
      throw new RrdException("Invalid suntax in: " + minimumStr);
    }
    String dsName = tokens[0];
    double minValue = Util.parseDouble(tokens[1]);
    Datasource ds = rrd.getDatasource(dsName);
    ds.setMinValue(minValue, false);
  }
View Full Code Here

    if (tokens.length != 2) {
      throw new RrdException("Invalid suntax in: " + maximumStr);
    }
    String dsName = tokens[0];
    double maxValue = Util.parseDouble(tokens[1]);
    Datasource ds = rrd.getDatasource(dsName);
    ds.setMaxValue(maxValue, false);
  }
View Full Code Here

    String[] tokens = new ColonSplitter(nameStr).split();
    if (tokens.length != 2) {
      throw new RrdException("Invalid suntax in: " + nameStr);
    }
    String oldName = tokens[0], newName = tokens[1];
    Datasource ds = rrd.getDatasource(oldName);
    ds.setDsName(newName);
  }
View Full Code Here

    if (tokens.length != 2) {
      throw new RrdException("Invalid suntax in: " + typeStr);
    }
    String dsName = tokens[0];
    String dsType = tokens[1];
    Datasource ds = rrd.getDatasource(dsName);
    ds.setDsType(dsType);
  }
View Full Code Here

  private void dump(RrdDb rrd) throws IOException {
    StringBuffer line = new StringBuffer();
    int n = rrd.getDsCount();
    for (int i = 0; i < n; i++) {
      Datasource ds = rrd.getDatasource(i);
      line.append("DS[");
      line.append(ds.getDsName());
      line.append("] typ: ");
      line.append(ds.getDsType());
      while (line.length() < 24) {
        line.append(' ');
      }
      line.append("hbt: ");
      line.append(ds.getHeartbeat());
      while (line.length() < 40) {
        line.append(' ');
      }
      line.append("min: ");
      line.append(String.format("%-11f", ds.getMinValue()));
      line.append("max: ");
      line.append(String.format("%-11f", ds.getMaxValue()));
      println(line.toString());
      line.setLength(0);
    }
  }
View Full Code Here

    b.append("filename = \"").append(rrd.getPath()).append("\"\n");
    b.append("rrd_version = \"0001\"\n");
    b.append("step = ").append(rrd.getHeader().getStep()).append("\n");
    b.append("last_update = ").append(rrd.getHeader().getLastUpdateTime()).append("\n");
    for (int i = 0; i < rrd.getDsCount(); i++) {
      Datasource ds = rrd.getDatasource(i);
      b.append("ds[").append(ds.getDsName()).append("].type = \"").append(ds.getDsType()).append("\"\n");
      b.append("ds[").append(ds.getDsName()).append("].minimal_heartbeat = ").
          append(ds.getHeartbeat()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].min = ").append(ds.getMinValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].max = ").append(ds.getMaxValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].last_ds = ").append(ds.getLastValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].value = ").append(ds.getAccumValue()).append("\n");
      b.append("ds[").append(ds.getDsName()).append("].unknown_sec = ").append(ds.getNanSeconds()).append("\n");
    }
    for (int i = 0; i < rrd.getArcCount(); i++) {
      Archive arc = rrd.getArchive(i);
      b.append("rra[").append(i).append("].cf = \"").append(arc.getConsolFun()).append("\"\n");
      b.append("rra[").append(i).append("].rows = ").append(arc.getRows()).append("\n");
View Full Code Here

TOP

Related Classes of org.jrobin.core.Datasource

Copyright © 2018 www.massapicom. 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.