/** * Returns all (MIN, MAX, LAST, FIRST, AVERAGE and TOTAL) aggregated values for a single datasource. * * @param sourceName Datasource name * @return Object containing all aggregated values * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public Aggregates getAggregates(String sourceName) throws RrdException { Source source = getSource(sourceName); return source.getAggregates(tStart, tEnd); }
/** * Returns single aggregated value for a single datasource. * * @param sourceName Datasource name * @param consolFun Consolidation function to be applied to fetched datasource values. * Valid consolidation functions are MIN, MAX, LAST, FIRST, AVERAGE and TOTAL * (these string constants are conveniently defined in the {@link ConsolFuns} class) * @return MIN, MAX, LAST, FIRST, AVERAGE or TOTAL value calculated from the data * for the given datasource name * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double getAggregate(String sourceName, String consolFun) throws RrdException { Source source = getSource(sourceName); return source.getAggregates(tStart, tEnd).getAggregate(consolFun); }
/** * The same as {@link #getPercentile(String)} but with a possibility to define custom percentile boundary * (different from 95). * * @param sourceName Datasource name. * @param percentile Boundary percentile. Value of 95 (%) is suitable in most cases, but you are free * to provide your own percentile boundary between zero and 100. * @return Requested percentile of fetched source values * @throws RrdException Thrown if invalid sourcename is supplied, or if the percentile value makes no sense. */ public double getPercentile(String sourceName, double percentile) throws RrdException { if (percentile <= 0.0 || percentile > 100.0) { throw new RrdException("Invalid percentile [" + percentile + "], should be between 0 and 100"); } Source source = getSource(sourceName); return source.getPercentile(tStart, tEnd, percentile); }
/** * Returns calculated values for a single datasource. Corresponding timestamps can be obtained from * the {@link #getTimestamps()} method. * * @param sourceName Datasource name * @return an array of datasource values * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double[] getValues(String sourceName) throws RrdException { Source source = getSource(sourceName); double[] values = source.getValues(); if (values == null) { throw new RrdException("Values not available for source [" + sourceName + "]"); } return values; }
private void calculateSDef(SDef sDef) throws RrdException { String defName = sDef.getDefName(); String consolFun = sDef.getConsolFun(); Source source = getSource(defName); if (consolFun.equals("MAXIMUM")) { consolFun = "MAX"; } else if (consolFun.equals("MINIMUM")) { consolFun = "MIN"; } double value = source.getAggregates(tStart, tEnd).getAggregate(consolFun); sDef.setValue(value); }
/** * Returns all (MIN, MAX, LAST, FIRST, AVERAGE and TOTAL) aggregated values for a single datasource. * * @param sourceName Datasource name * @return Object containing all aggregated values * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public Aggregates getAggregates(String sourceName) throws RrdException { Source source = getSource(sourceName); return source.getAggregates(tStart, tEnd); }
/** * Returns calculated values for a single datasource. Corresponding timestamps can be obtained from * the {@link #getTimestamps()} method. * * @param sourceName Datasource name * @return an array of datasource values * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double[] getValues(String sourceName) throws RrdException { Source source = getSource(sourceName); double[] values = source.getValues(); if (values == null) { throw new RrdException("Values not available for source [" + sourceName + "]"); } return values; }
/** * The same as {@link #getPercentile(String)} but with a possibility to define custom percentile boundary * (different from 95). * * @param sourceName Datasource name. * @param percentile Boundary percentile. Value of 95 (%) is suitable in most cases, but you are free * to provide your own percentile boundary between zero and 100. * @return Requested percentile of fetched source values * @throws RrdException Thrown if invalid sourcename is supplied, or if the percentile value makes no sense. */ public double getPercentile(String sourceName, double percentile) throws RrdException { if (percentile <= 0.0 || percentile > 100.0) { throw new RrdException("Invalid percentile [" + percentile + "], should be between 0 and 100"); } Source source = getSource(sourceName); return source.getPercentile(tStart, tEnd, percentile); }
/** * Returns single aggregated value for a single datasource. * * @param sourceName Datasource name * @param consolFun Consolidation function to be applied to fetched datasource values. * Valid consolidation functions are MIN, MAX, LAST, FIRST, AVERAGE and TOTAL * (these string constants are conveniently defined in the {@link ConsolFuns} class) * @return MIN, MAX, LAST, FIRST, AVERAGE or TOTAL value calculated from the data * for the given datasource name * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double getAggregate(String sourceName, String consolFun) throws RrdException { Source source = getSource(sourceName); return source.getAggregates(tStart, tEnd).getAggregate(consolFun); }
private void calculateSDef(SDef sDef) throws RrdException { String defName = sDef.getDefName(); String consolFun = sDef.getConsolFun(); Source source = getSource(defName); double value = source.getAggregates(tStart, tEnd).getAggregate(consolFun); sDef.setValue(value); }