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 voidafterPropertiesSet()afterPropertiesSetInputStreamcreateGraph(String command)Create an RRD graph with the given command where RRD files are relative to the workDir.intgetGraphLeftOffset()getGraphLeftOffsetintgetGraphRightOffset()getGraphRightOffsetintgetGraphTopOffsetWithText()getGraphTopOffsetWithTextDoublegetLastFetchValue(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)getPrintValuesFilegetRrdBaseDirectory()getRrdBaseDirectoryStringgetRrdBinaryPath()getRrdBinaryPathRrdStrategy<?,?>getRrdStrategy()getRrdStrategyvoidsetRrdBaseDirectory(File rrdBaseDirectory)setRrdBaseDirectoryvoidsetRrdBinaryPath(String rrdBinaryPath)setRrdBinaryPathvoidsetRrdStrategy(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:
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)
getPrintValues
- Specified by:
getPrintValuesin interfaceRrdDao- Parameters:
attribute- aOnmsAttributeobject.rraConsolidationFunction- aStringobject.startTimeInMillis- a long.endTimeInMillis- a long.printFunctions- aStringobject.- Returns:
- an array of double.
-
afterPropertiesSet
public void afterPropertiesSet() throws ExceptionafterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception- if any.
-
getRrdStrategy
public RrdStrategy<?,?> getRrdStrategy()
getRrdStrategy
- Returns:
- a
RrdStrategyobject.
-
setRrdStrategy
public void setRrdStrategy(RrdStrategy<?,?> rrdStrategy)
setRrdStrategy
- Parameters:
rrdStrategy- aRrdStrategyobject.
-
setRrdBaseDirectory
public void setRrdBaseDirectory(File rrdBaseDirectory)
setRrdBaseDirectory
- Parameters:
rrdBaseDirectory- aFileobject.
-
setRrdBinaryPath
public void setRrdBinaryPath(String rrdBinaryPath)
setRrdBinaryPath
- Parameters:
rrdBinaryPath- aStringobject.
-
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:
createGraphin 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:
getGraphTopOffsetWithTextin interfaceRrdDao- Returns:
- a int.
- See Also:
RrdDao.getGraphTopOffsetWithText()
-
getGraphLeftOffset
public int getGraphLeftOffset()
getGraphLeftOffset
- Specified by:
getGraphLeftOffsetin interfaceRrdDao- Returns:
- a int.
- See Also:
RrdDao.getGraphLeftOffset()
-
getGraphRightOffset
public int getGraphRightOffset()
getGraphRightOffset
- Specified by:
getGraphRightOffsetin 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:
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.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:
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.DataAccessResourceFailureException
-
-