/** * Returns an array of last datasource values. The first value in the array corresponds * to the first datasource defined in the RrdDb and so on. * * @return Array of last datasource values * @throws IOException Thrown in case of I/O error */ public synchronized double[] getLastDatasourceValues() throws IOException { double[] values = new double[datasources.length]; for (int i = 0; i < values.length; i++) { values[i] = datasources[i].getLastValue(); } return values; }
/** * Returns an array of last datasource values. The first value in the array corresponds * to the first datasource defined in the RrdDb and so on. * * @return Array of last datasource values * @throws java.io.IOException Thrown in case of I/O error */ public synchronized double[] getLastDatasourceValues() throws IOException { double[] values = new double[datasources.length]; for (int i = 0; i < values.length; i++) { values[i] = datasources[i].getLastValue(); } return values; }
/** * Returns the last stored value for the given datasource. * * @param dsName Datasource name * @return Last stored value for the given datasource * @throws IOException Thrown in case of I/O error * @throws IllegalArgumentException Thrown if no datasource in this RrdDb matches the given datasource name */ public synchronized double getLastDatasourceValue(String dsName) throws IOException { int dsIndex = getDsIndex(dsName); return datasources[dsIndex].getLastValue(); }
/** * Returns the last stored value for the given datasource. * * @param dsName Datasource name * @return Last stored value for the given datasource * @throws java.io.IOException Thrown in case of I/O error * @throws java.lang.IllegalArgumentException Thrown if no datasource in this RrdDb matches the given datasource name */ public synchronized double getLastDatasourceValue(String dsName) throws IOException { int dsIndex = getDsIndex(dsName); return datasources[dsIndex].getLastValue(); }
public Map<String, Number> getLastValues() { Map<String, Number> retValues = new HashMap<String, Number>(); RrdDb rrdDb = null; try { rrdDb = factory.getRrd(getPath()); String[] dsNames = rrdDb.getDsNames(); for(int i = 0; i < dsNames.length; i++) { retValues.put(dsNames[i], rrdDb.getDatasource(i).getLastValue()); } } catch (Exception e) { log(Level.ERROR, e, "Unable to get last values: %s", e.getMessage()); } finally { if(rrdDb != null) factory.releaseRrd(rrdDb); } return retValues; }
assertTrue(db.getDatasource("transactions!").getLastValue() > 0); assertTrue(db.getDatasource("min").getLastValue() > 0); assertTrue(db.getDatasource("max").getLastValue() > db.getDatasource("min").getLastValue()); assertTrue(db.getDatasource("average").getLastValue() > db.getDatasource("min").getLastValue()); assertTrue(db.getDatasource("max").getLastValue() > db.getDatasource("average").getLastValue());
InspectorModel.formatDouble(ds.getMinValue()), InspectorModel.formatDouble(ds.getMaxValue()), InspectorModel.formatDouble(ds.getLastValue()), InspectorModel.formatDouble(ds.getAccumValue()), "" + ds.getNanSeconds()