rrd
Class Rrd.FetchData

java.lang.Object
  |
  +--rrd.Rrd.FetchData
Enclosing class:
Rrd

public class Rrd.FetchData
extends java.lang.Object

Inner class to hold information returned by Rrd.fetch(). Logically, this information represents one simple table. Here is the example:

 timestamp     temperature1    temperature2
 ==========================================
 1000000000        36.2           66.9
 1000005000        39.3           69.2
 1000010000        40.0           68.3
 ..........        ....           ....
 1001000000        39.6           66.7
 ==========================================
 
To read this data use the following methods:

Example:

 String cmd = "fetch temperatures.rrd AVERAGE --start 1000000000 --end 1000086400";
 rrd.Rrd.FetchData data = Rrd.getInstance().fetch(cmd);
 int rows = data.getRowCount(), cols = data.getColCount();
 for(int i = 0; i < rows; i++) {
     System.out.print(i + ": t=" + data.getTimestamp(i) + " ");
     for(int j = 0; j < cols; j++) {
         System.out.print(data.getColName(j) + "=" + data.getValue(i, j) + " ");
     }
     System.out.println();
 }
 


Method Summary
 int getColCount()
          Returns number of columns (data sources) generated by Rrd.fetch() method.
 java.lang.String getColName(int col)
          Returns column (data source) name for the given column number
 int getRowCount()
          Returns number of rows generated by Rrd.fetch() method.
 long getTimestamp(int row)
          Returns timestamp of the given row.
 double getValue(int row, int col)
          Returns data source value from RRD database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTimestamp

public long getTimestamp(int row)
Returns timestamp of the given row.

Parameters:
row - Zero-based row number
Returns:
timestamp of the given row

getValue

public double getValue(int row,
                       int col)
Returns data source value from RRD database.

Parameters:
row - Zero-based row number.
col - Zero based data column number.
Returns:
value from the RRD database for the given row and column.

getColName

public java.lang.String getColName(int col)
Returns column (data source) name for the given column number

Parameters:
col - Zero-based column number.
Returns:
Column (data source) name

getColCount

public int getColCount()
Returns number of columns (data sources) generated by Rrd.fetch() method.

Returns:
Number of columns

getRowCount

public int getRowCount()
Returns number of rows generated by Rrd.fetch() method.

Returns:
Number of rows