|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jrobin.core.FetchData
public class FetchData
Class used to represent data fetched from the RRD.
Object of this class is created when the method
fetchData()
is
called on a FetchRequest
object.
Data returned from the RRD is, simply, just one big table filled with timestamps and corresponding datasource values. Use
getRowCount()
method to count the number
of returned timestamps (table rows).The first table column is filled with timestamps. Time intervals between consecutive timestamps are guaranteed to be equal. Use
getTimestamps()
method to get an array of
timestamps returned.Remaining columns are filled with datasource values for the whole timestamp range, on a column-per-datasource basis. Use
getColumnCount()
to find
the number of datasources and getValues(i)
method to obtain
all values for the i-th datasource. Returned datasource values correspond to
the values returned with getTimestamps()
method.
Field Summary |
---|
Fields inherited from interface org.jrobin.core.ConsolFuns |
---|
CF_AVERAGE, CF_FIRST, CF_LAST, CF_MAX, CF_MIN, CF_TOTAL |
Method Summary | |
---|---|
java.lang.String |
dump()
Dumps the content of the whole FetchData object. |
java.lang.String |
exportXml()
Dumps fetch data in XML format. |
void |
exportXml(java.io.OutputStream outputStream)
Dumps fetch data to output stream in XML format. |
void |
exportXml(java.lang.String filepath)
Dumps fetch data to file in XML format. |
double |
get95Percentile(java.lang.String dsName)
Used by ISPs which charge for bandwidth utilization on a "95th percentile" basis. |
double |
getAggregate(java.lang.String dsName,
java.lang.String consolFun)
Returns single aggregated value from the fetched data for a single datasource. |
double |
getAggregate(java.lang.String dsName,
java.lang.String consolFun,
java.lang.String rpnExpression)
Deprecated. This method is preserved just for backward compatibility. |
Aggregates |
getAggregates(java.lang.String dsName)
Returns all aggregated values (MIN, MAX, LAST, FIRST, AVERAGE or TOTAL) calculated from the fetched data for a single datasource. |
long |
getArcEndTime()
Returns the timestamp of the last populated slot in the corresponding RRA archive |
long |
getArcStep()
Returns the step of the corresponding RRA archive |
int |
getColumnCount()
Returns the number of columns fetched from the corresponding RRD. |
int |
getDsIndex(java.lang.String dsName)
Retrieve the table index number of a datasource by name. |
java.lang.String[] |
getDsNames()
Returns array of datasource names found in the corresponding RRD. |
long |
getFirstTimestamp()
Returns the first timestamp in this FetchData object. |
long |
getLastTimestamp()
Returns the last timestamp in this FecthData object. |
Archive |
getMatchingArchive()
Returns Archive object which is determined to be the best match for the timestamps specified in the fetch request. |
FetchRequest |
getRequest()
Returns FetchRequest object used to create this FetchData object. |
int |
getRowCount()
Returns the number of rows fetched from the corresponding RRD. |
double |
getRpn95Percentile(java.lang.String rpnExpression)
Same as get95Percentile(String) , but for a set of values calculated with the given
RPN expression. |
double |
getRpnAggregate(java.lang.String rpnExpression,
java.lang.String consolFun)
Returns aggregated value for a set of values calculated by applying an RPN expression to the fetched data. |
Aggregates |
getRpnAggregates(java.lang.String rpnExpression)
Returns all aggregated values for a set of values calculated by applying an RPN expression to the fetched data. |
double[] |
getRpnValues(java.lang.String rpnExpression)
Returns a set of values created by applying RPN expression to the fetched data. |
long |
getStep()
Returns the step with which this data was fetched. |
long[] |
getTimestamps()
Returns an array of timestamps covering the whole range specified in the FetchReguest object. |
double[][] |
getValues()
Returns all archived values for all datasources. |
double[] |
getValues(int dsIndex)
Returns all archived values for a single datasource. |
double[] |
getValues(java.lang.String dsName)
Returns all archived values for a single datasource. |
java.lang.String |
toString()
Returns string representing fetched data in a RRDTool-like form. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public int getRowCount()
public int getColumnCount()
public long[] getTimestamps()
FetchReguest
object.
public long getStep()
public double[] getValues(int dsIndex)
getTimestamps()
method.
dsIndex
- Datasource index.
public double[][] getValues()
getTimestamps()
method.
public double[] getValues(java.lang.String dsName) throws RrdException
getTimestamps()
method.
dsName
- Datasource name.
RrdException
- Thrown if no matching datasource name is found.public double[] getRpnValues(java.lang.String rpnExpression) throws RrdException
x
and y
in this FetchData and you want to calculate values for (x+y)/2 use something like:
getRpnValues("x,y,+,2,/");
- Parameters:
rpnExpression
- RRDTool-like RPN expression
- Returns:
- Calculated values
- Throws:
RrdException
- Thrown if invalid RPN expression is supplied
public FetchRequest getRequest()
FetchRequest
object used to create this FetchData object.
public long getFirstTimestamp()
public long getLastTimestamp()
public Archive getMatchingArchive()
public java.lang.String[] getDsNames()
public int getDsIndex(java.lang.String dsName)
dsName
- Name of the datasource for which to find the index.
public java.lang.String dump()
public java.lang.String toString()
toString
in class java.lang.Object
public double getAggregate(java.lang.String dsName, java.lang.String consolFun) throws RrdException
dsName
- Datasource nameconsolFun
- 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 ConsolFuns
class)
RrdException
- Thrown if the given datasource name cannot be found in fetched data.public double getAggregate(java.lang.String dsName, java.lang.String consolFun, java.lang.String rpnExpression) throws RrdException, java.io.IOException
getAggregate("foots", "MAX", "foots,0.3048,*");
dsName
- Datasource nameconsolFun
- Consolidation function (MIN, MAX, LAST, FIRST, AVERAGE or TOTAL)rpnExpression
- RRDTool-like RPN expression
RrdException
- Thrown if the given datasource name cannot be found in fetched data, or if
invalid RPN expression is supplied
java.io.IOException
- Thrown in case of I/O error (unlikely to happen)public double getRpnAggregate(java.lang.String rpnExpression, java.lang.String consolFun) throws RrdException
x
and y
in this FetchData and you want to calculate MAX value of (x+y)/2 use something like:
getRpnAggregate("x,y,+,2,/", "MAX");
- Parameters:
rpnExpression
- RRDTool-like RPN expressionconsolFun
- Consolidation function (MIN, MAX, LAST, FIRST, AVERAGE or TOTAL)
- Returns:
- Aggregated value
- Throws:
RrdException
- Thrown if invalid RPN expression is supplied
public Aggregates getAggregates(java.lang.String dsName) throws RrdException
dsName
- Datasource name.
RrdException
- Thrown if the given datasource name cannot be found in the fetched data.public Aggregates getRpnAggregates(java.lang.String rpnExpression) throws RrdException, java.io.IOException
x
and y
in this FetchData and you want to calculate MIN, MAX, LAST, FIRST, AVERAGE and TOTAL value
of (x+y)/2 use something like:
getRpnAggregates("x,y,+,2,/");
- Parameters:
rpnExpression
- RRDTool-like RPN expression
- Returns:
- Object containing all aggregated values
- Throws:
RrdException
- Thrown if invalid RPN expression is supplied
java.io.IOException
public double get95Percentile(java.lang.String dsName) throws RrdException
The 95th percentile is the highest source value left when the top 5% of a numerically sorted set of source data is discarded. It is used as a measure of the peak value used when one discounts a fair amount for transitory spikes. This makes it markedly different from the average.
Read more about this topic at:
dsName
- Datasource name
RrdException
- Thrown if invalid source name is suppliedpublic double getRpn95Percentile(java.lang.String rpnExpression) throws RrdException
get95Percentile(String)
, but for a set of values calculated with the given
RPN expression.
rpnExpression
- RRDTool-like RPN expression
RrdException
- Thrown if invalid RPN expression is suppliedpublic void exportXml(java.io.OutputStream outputStream) throws java.io.IOException
outputStream
- Output stream to dump fetch data to
java.io.IOException
- Thrown in case of I/O errorpublic void exportXml(java.lang.String filepath) throws java.io.IOException
filepath
- Path to destination file
java.io.IOException
- Thrown in case of I/O errorpublic java.lang.String exportXml() throws java.io.IOException
java.io.IOException
- Thrown in case of I/O errorpublic long getArcStep()
public long getArcEndTime()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |