Package org.opennms.netmgt.dao.support
Class DefaultRrdDao
- java.lang.Object
-
- org.opennms.netmgt.dao.support.DefaultRrdDao
-
-
Constructor Summary
Constructors Constructor Description DefaultRrdDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
afterPropertiesSetInputStream
createGraph(String command)
Create an RRD graph with the given command where RRD files are relative to the workDir.int
getGraphLeftOffset()
getGraphLeftOffsetint
getGraphRightOffset()
getGraphRightOffsetint
getGraphTopOffsetWithText()
getGraphTopOffsetWithTextDouble
getLastFetchValue(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.Double
getLastFetchValue(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.double
getPrintValue(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)
getPrintValuesFile
getRrdBaseDirectory()
getRrdBaseDirectoryString
getRrdBinaryPath()
getRrdBinaryPathRrdStrategy<?,?>
getRrdStrategy()
getRrdStrategyvoid
setRrdBaseDirectory(File rrdBaseDirectory)
setRrdBaseDirectoryvoid
setRrdBinaryPath(String rrdBinaryPath)
setRrdBinaryPathvoid
setRrdStrategy(RrdStrategy<?,?> rrdStrategy)
setRrdStrategy
-
-
-
Method Detail
-
getPrintValue
public double getPrintValue(OnmsAttribute attribute, String cf, long start, long end)
Get the value for an attribute over a period of time.- Specified by:
getPrintValue
in 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)
getPrintValues
- Specified by:
getPrintValues
in interfaceRrdDao
- Parameters:
attribute
- aOnmsAttribute
object.rraConsolidationFunction
- aString
object.startTimeInMillis
- a long.endTimeInMillis
- a long.printFunctions
- aString
object.- Returns:
- an array of double.
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
- if any.
-
getRrdStrategy
public RrdStrategy<?,?> getRrdStrategy()
getRrdStrategy
- Returns:
- a
RrdStrategy
object.
-
setRrdStrategy
public void setRrdStrategy(RrdStrategy<?,?> rrdStrategy)
setRrdStrategy
- Parameters:
rrdStrategy
- aRrdStrategy
object.
-
setRrdBaseDirectory
public void setRrdBaseDirectory(File rrdBaseDirectory)
setRrdBaseDirectory
- Parameters:
rrdBaseDirectory
- aFile
object.
-
setRrdBinaryPath
public void setRrdBinaryPath(String rrdBinaryPath)
setRrdBinaryPath
- Parameters:
rrdBinaryPath
- aString
object.
-
createGraph
public InputStream createGraph(String command) throws org.springframework.dao.DataRetrievalFailureException
Create an RRD graph with the given command where RRD files are relative to the workDir. Create an RRD graph.- Specified by:
createGraph
in interfaceRrdDao
- Parameters:
command
- RRD graph command- Returns:
- PNG graph image
- Throws:
org.springframework.dao.DataRetrievalFailureException
- See Also:
org.opennms.netmgt.dao.api.RrdDao#createGraph(java.lang.String, java.io.File)
-
getGraphTopOffsetWithText
public int getGraphTopOffsetWithText()
getGraphTopOffsetWithText
- Specified by:
getGraphTopOffsetWithText
in interfaceRrdDao
- Returns:
- a int.
- See Also:
RrdDao.getGraphTopOffsetWithText()
-
getGraphLeftOffset
public int getGraphLeftOffset()
getGraphLeftOffset
- Specified by:
getGraphLeftOffset
in interfaceRrdDao
- Returns:
- a int.
- See Also:
RrdDao.getGraphLeftOffset()
-
getGraphRightOffset
public int getGraphRightOffset()
getGraphRightOffset
- Specified by:
getGraphRightOffset
in interfaceRrdDao
- Returns:
- a int.
- See Also:
RrdDao.getGraphRightOffset()
-
getLastFetchValue
public Double getLastFetchValue(OnmsAttribute attribute, int interval) throws org.springframework.dao.DataAccessResourceFailureException
This 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:
getLastFetchValue
in 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.DataAccessResourceFailureException
-
getLastFetchValue
public Double getLastFetchValue(OnmsAttribute attribute, int interval, int range) throws org.springframework.dao.DataAccessResourceFailureException
This 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:
getLastFetchValue
in 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.DataAccessResourceFailureException
-
-