Package org.rrd4j.core

Examples of org.rrd4j.core.FetchData


          start = filter.getBeginDate().getTime()/1000;
        }
        FetchRequest request = db.createFetchRequest(consolidationFunction, start, end, 1);

        List<HistoricItem> items = new ArrayList<HistoricItem>();
        FetchData result = request.fetchData();
        long ts = result.getFirstTimestamp();
        long step = result.getRowCount() > 1 ? result.getStep() : 0;
        for(double value : result.getValues(DATASOURCE_STATE)) {
          if(!Double.isNaN(value)) {
            RRD4jItem rrd4jItem = new RRD4jItem(itemName, mapToState(value, itemName), new Date(ts * 1000));
            items.add(rrd4jItem);
          }
          ts += step;
View Full Code Here


      try {
        RrdDb rrdDb = new RrdDb("./etc/rrd4j/" + rrdName);
        long[] times = Util.getTimestamps(start, end);
        FetchRequest fetchRequest = rrdDb.createFetchRequest(
            ConsolFun.valueOf(ds), times[0], times[1], res);
        FetchData fetchData = fetchRequest.fetchData();
        StringBuilder buffer = new StringBuilder();
        long[] timestamps = fetchData.getTimestamps();
        double[][] values = fetchData.getValues();
        buffer.append("[");
        for (int row = 0; row < fetchData.getRowCount(); row++) {
          // change to microseconds
          buffer.append("[" + (timestamps[row]*1000) + ",");
          buffer.append("[");
          ArrayList<String> data = new ArrayList<String>();
          for (int dsIndex = 0; dsIndex < fetchData.getColumnCount(); dsIndex++) {
            data.add(dsIndex,RrdResource.formatDouble(values[dsIndex][row],"null",true));
          }
          buffer.append(StringUtils.join(data, ","));
          buffer.append("]],");
        }
View Full Code Here

TOP

Related Classes of org.rrd4j.core.FetchData

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.