public class FetchData extends Object
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.
Modifier and Type | Method and Description |
---|---|
String |
dump()
Dumps the content of the whole FetchData object.
|
String |
exportXml()
Dumps fetch data in XML format.
|
void |
exportXml(OutputStream outputStream)
Dumps fetch data to output stream in XML format.
|
void |
exportXml(String filepath)
Dumps fetch data to file in XML format.
|
double |
get95Percentile(String dsName)
Deprecated.
This method is deprecated. Uses instance of
Variable.PERCENTILE , used with DataProcessor.addDatasource(String, String, Variable) |
double |
getAggregate(String dsName,
ConsolFun consolFun)
Deprecated.
This method is deprecated. Uses instance of
Variable , used with DataProcessor.addDatasource(String, String, Variable) |
Aggregates |
getAggregates(String dsName)
Deprecated.
This method is deprecated. Uses instance of
Variable , used with DataProcessor.addDatasource(String, String, Variable) |
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(String dsName)
Retrieve the table index number of a datasource by name.
|
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(String rpnExpression)
Deprecated.
This method is deprecated. Uses instance of
Variable.PERCENTILE , used with DataProcessor.addDatasource(String, String, Variable) |
double |
getRpnAggregate(String rpnExpression,
ConsolFun consolFun)
Deprecated.
This method is deprecated. Uses instance of
Variable , used with DataProcessor.addDatasource(String, String, Variable) |
Aggregates |
getRpnAggregates(String rpnExpression)
Deprecated.
This method is deprecated. Uses instance of
Variable , used with DataProcessor.addDatasource(String, String, Variable) |
double[] |
getRpnValues(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(String dsName)
Returns all archived values for a single datasource.
|
String |
toString()
Returns string representing fetched data in a RRDTool-like form.
|
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(String dsName)
getTimestamps()
method.dsName
- Datasource name.public double[] getRpnValues(String rpnExpression)
x
and y
in this FetchData and you want to calculate values for (x+y)/2
use something like:
getRpnValues("x,y,+,2,/");
rpnExpression
- RRDTool-like RPN expressionIllegalArgumentException
- Thrown if invalid RPN expression is suppliedpublic FetchRequest getRequest()
FetchRequest
object used to create this FetchData object.public long getFirstTimestamp()
public long getLastTimestamp()
public Archive getMatchingArchive()
public String[] getDsNames()
public int getDsIndex(String dsName)
dsName
- Name of the datasource for which to find the index.public String dump()
String
containing the contents of this object, for debugging.public String toString()
@Deprecated public double getAggregate(String dsName, ConsolFun consolFun)
Variable
, used with DataProcessor.addDatasource(String, String, Variable)
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 ConsolFun
class)IllegalArgumentException
- Thrown if the given datasource name cannot be found in fetched data.@Deprecated public double getRpnAggregate(String rpnExpression, ConsolFun consolFun)
Variable
, used with DataProcessor.addDatasource(String, String, Variable)
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");
rpnExpression
- RRDTool-like RPN expressionconsolFun
- Consolidation function (MIN, MAX, LAST, FIRST, AVERAGE or TOTAL)IllegalArgumentException
- Thrown if invalid RPN expression is supplied@Deprecated public Aggregates getAggregates(String dsName)
Variable
, used with DataProcessor.addDatasource(String, String, Variable)
dsName
- Datasource name.IllegalArgumentException
- Thrown if the given datasource name cannot be found in the fetched data.@Deprecated public Aggregates getRpnAggregates(String rpnExpression) throws IOException
Variable
, used with DataProcessor.addDatasource(String, String, Variable)
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,/");
rpnExpression
- RRDTool-like RPN expressionIllegalArgumentException
- Thrown if invalid RPN expression is suppliedIOException
- if any.@Deprecated public double get95Percentile(String dsName)
Variable.PERCENTILE
, used with DataProcessor.addDatasource(String, String, Variable)
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 nameIllegalArgumentException
- Thrown if invalid source name is supplied@Deprecated public double getRpn95Percentile(String rpnExpression)
Variable.PERCENTILE
, used with DataProcessor.addDatasource(String, String, Variable)
get95Percentile(String)
, but for a set of values calculated with the given
RPN expression.rpnExpression
- RRDTool-like RPN expressionIllegalArgumentException
- Thrown if invalid RPN expression is suppliedpublic void exportXml(OutputStream outputStream) throws IOException
outputStream
- Output stream to dump fetch data toIOException
- Thrown in case of I/O errorpublic void exportXml(String filepath) throws IOException
filepath
- Path to destination fileIOException
- Thrown in case of I/O errorpublic String exportXml() throws IOException
IOException
- Thrown in case of I/O errorpublic long getArcStep()
public long getArcEndTime()
© 2018 The RRD4J Authors. © 2001-2005 Sasa Markovic and Ciaran Treanor. © 2018 The OpenNMS Group, Inc.