Package org.opennms.netmgt.dao.mock
Class MockRrdDao
- java.lang.Object
-
- org.opennms.netmgt.dao.mock.MockRrdDao
-
-
Constructor Summary
Constructors Constructor Description MockRrdDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamcreateGraph(String command)Create an RRD graph with the given command where RRD files are relative to the workDir.intgetGraphLeftOffset()Gets the offset of the left side of the graph box from the left side of the image.intgetGraphRightOffset()Gets the offset of the right side of the graph box from the right side of the image.intgetGraphTopOffsetWithText()Gets the offset of the top of the graph box from the top of the image.DoublegetLastFetchValue(OnmsAttribute attribute, int interval)This method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file.DoublegetLastFetchValue(OnmsAttribute attribute, int interval, int range)This method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file.doublegetPrintValue(OnmsAttribute attribute, String cf, long start, long end)Get the value for an attribute over a period of time.double[]getPrintValues(OnmsAttribute attribute, String rraConsolidationFunction, long startTimeInMillis, long endTimeInMillis, String... printFunctions)Get the value for an attribute over a period of time.
-
-
-
Method Detail
-
getPrintValue
public double getPrintValue(OnmsAttribute attribute, String cf, long start, long end)
Description copied from interface:RrdDaoGet the value for an attribute over a period of time.- Specified by:
getPrintValuein interfaceRrdDao- Parameters:
attribute- the attributecf- consolidation function (usually "AVERAGE")start- start time in millisecondsend- end time in milliseconds- Returns:
- value
-
getPrintValues
public double[] getPrintValues(OnmsAttribute attribute, String rraConsolidationFunction, long startTimeInMillis, long endTimeInMillis, String... printFunctions)
Description copied from interface:RrdDaoGet the value for an attribute over a period of time.- Specified by:
getPrintValuesin interfaceRrdDao- Parameters:
attribute- the attributerraConsolidationFunction- consolidation function (usually "AVERAGE")startTimeInMillis- start time in millisecondsendTimeInMillis- end time in millisecondsprintFunctions- aStringobject.- Returns:
- value
-
createGraph
public InputStream createGraph(String command)
Description copied from interface:RrdDaoCreate an RRD graph with the given command where RRD files are relative to the workDir.- Specified by:
createGraphin interfaceRrdDao- Parameters:
command- RRD graph command- Returns:
- PNG graph image
-
getGraphTopOffsetWithText
public int getGraphTopOffsetWithText()
Description copied from interface:RrdDaoGets the offset of the top of the graph box from the top of the image.- Specified by:
getGraphTopOffsetWithTextin interfaceRrdDao- Returns:
- offset in pixels
-
getGraphLeftOffset
public int getGraphLeftOffset()
Description copied from interface:RrdDaoGets the offset of the left side of the graph box from the left side of the image.- Specified by:
getGraphLeftOffsetin interfaceRrdDao- Returns:
- offset in pixels
-
getGraphRightOffset
public int getGraphRightOffset()
Description copied from interface:RrdDaoGets the offset of the right side of the graph box from the right side of the image.- Specified by:
getGraphRightOffsetin interfaceRrdDao- Returns:
- offset in pixels
-
getLastFetchValue
public Double getLastFetchValue(OnmsAttribute attribute, int interval) throws org.springframework.dao.DataAccessException
Description copied from interface:RrdDaoThis method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file. NOTE: This method assumes that each RRD file contains a single data source.- Specified by:
getLastFetchValuein interfaceRrdDao- Parameters:
attribute- The attribute for which fetch the last value. Must be a RrdGraphAttribute.interval- Fetch interval. This should equal RRD step size.- Returns:
- Retrived value or null if some errors occur
- Throws:
org.springframework.dao.DataAccessException- if an error occurs retrieving the last value
-
getLastFetchValue
public Double getLastFetchValue(OnmsAttribute attribute, int interval, int range) throws org.springframework.dao.DataAccessException
Description copied from interface:RrdDaoThis method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file. NOTE: This method assumes that each RRD file contains a single data source.- Specified by:
getLastFetchValuein interfaceRrdDao- Parameters:
attribute- The attribute for which fetch the last value. Must be a RrdGraphAttribute.interval- Fetch interval in milliseconds. This should equal the RRD step size.range- Interval in milliseconds for how long we should look back in time for a non-NaN value. This should a multiple of the RRD step size.- Returns:
- Retrived value or null if some errors occur
- Throws:
org.springframework.dao.DataAccessException- if an error occurs retrieving the last value
-
-