java.lang.Object
org.rrd4j.core.FetchRequest
Class to represent fetch request. For the complete explanation of all fetch parameters consult RRDTool's rrdfetch man page.
You cannot create FetchRequest directly (no public constructor is provided). Use createFetchRequest() method of your RrdDb object.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConsolFunConsolidation function to read with.private final longLast time to fetch.private final longFirst time to fetch.private String[]Data sources to fetch, all if empty.private final RrdDbThe database being read.private final longSpacing between fetched values, in seconds.Constructor Summary
ConstructorsConstructorDescriptionFetchRequest(RrdDb parentDb, ConsolFun consolFun, long fetchStart, long fetchEnd, long resolution) Create a fetch request covering the given time range.Method Summary
Public MethodsModifier and TypeMethodDescriptiondump()Dumps the content of fetch request using the syntax of RRDTool's fetch command.Returns data from the underlying RRD and puts it in a singleFetchDataobject.Returns consolidation function to be used during the fetch process.longReturns ending timestamp to be used for the fetch request.longReturns starting timestamp to be used for the fetch request.String[]Returns request filter.Returns the underlying RrdDb object.longReturns fetch resolution to be used for the fetch request.(package private) StringRender this request as the equivalent rrdtool fetch command.voidSets request filter in order to fetch data only for a single datasource (datasource name).voidSets request filter in order to fetch data only for the specified array of datasources (datasource names).voidSets request filter in order to fetch data only for the specified set of datasources (datasource names).
Field Details
parentDb
The database being read.consolFun
Consolidation function to read with.fetchStart
private final long fetchStartFirst time to fetch.fetchEnd
private final long fetchEndLast time to fetch.resolution
private final long resolutionSpacing between fetched values, in seconds.filter
Data sources to fetch, all if empty.
Constructor Details
FetchRequest
Create a fetch request covering the given time range.- Parameters:
parentDb- the parent RrdDbconsolFun- the consolidation functionfetchStart- the start timestampfetchEnd- the end timestampresolution- the archive resolution to fetch from
Method Details
setFilter
Sets request filter in order to fetch data only for the specified array of datasources (datasource names). If not set (or set to null), fetched data will contain values of all datasources defined in the corresponding RRD. To fetch data only from selected datasources, specify an array of datasource names as method argument.- Parameters:
filter- Array of datasources (datasource names) to fetch data from.
setFilter
Sets request filter in order to fetch data only for the specified set of datasources (datasource names). If the filter is not set (or set to null), fetched data will contain values of all datasources defined in the corresponding RRD. To fetch data only from selected datasources, specify a set of datasource names as method argument.- Parameters:
filter- Set of datasource names to fetch data for.
setFilter
Sets request filter in order to fetch data only for a single datasource (datasource name). If not set (or set to null), fetched data will contain values of all datasources defined in the corresponding RRD. To fetch data for a single datasource only, specify an array of datasource names as method argument.- Parameters:
filter- A single datasource (datasource name) to fetch data from.
getFilter
Returns request filter. SeesetFilter()for complete explanation.- Returns:
- Request filter (array of datasource names), null if not set.
getConsolFun
Returns consolidation function to be used during the fetch process.- Returns:
- the ConsolFun used to consolidate fetched archive rows, never null as the constructor rejects one
getFetchStart
public long getFetchStart()Returns starting timestamp to be used for the fetch request.- Returns:
- Starting timestamp in seconds.
getFetchEnd
public long getFetchEnd()Returns ending timestamp to be used for the fetch request.- Returns:
- Ending timestamp in seconds.
getResolution
public long getResolution()Returns fetch resolution to be used for the fetch request.- Returns:
- Fetch resolution in seconds.
dump
Dumps the content of fetch request using the syntax of RRDTool's fetch command.- Returns:
- Fetch request dump.
getRrdToolCommand
String getRrdToolCommand()Render this request as the equivalent rrdtool fetch command.- Returns:
- the rrdtool command string
fetchData
Returns data from the underlying RRD and puts it in a singleFetchDataobject.- Returns:
- FetchData object filled with timestamps and datasource values.
- Throws:
IOException- Thrown in case of I/O error.
getParentDb
Returns the underlying RrdDb object.- Returns:
- RrdDb object used to create this FetchRequest object.