Package org.rrd4j.core

Examples of org.rrd4j.core.FetchRequest


                "unless order is decending and a single value is requested");
          }
        } else {
          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));
 
View Full Code Here


   
    if (responseType != null) {
      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++) {
View Full Code Here

        }

        try
        {

            FetchRequest request = RrdManager.getRrdDB().createFetchRequest(
                    ConsolFun.AVERAGE, start, stop,
                    getResolutionFor( stop - start ) );

            String entity = JsonRenderers.DEFAULT.render( new RrdDataRepresentation(
                    request.fetchData() ) );

            return addHeaders(
                    Response.ok( entity, JsonRenderers.DEFAULT.getMediaType() ) ).build();
        }
        catch ( Exception e )
View Full Code Here

TOP

Related Classes of org.rrd4j.core.FetchRequest

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.