org.opennms.netmgt.dao.support
Class DefaultRrdDao

java.lang.Object
  extended by org.opennms.netmgt.dao.support.DefaultRrdDao
All Implemented Interfaces:
RrdDao, org.springframework.beans.factory.InitializingBean

public class DefaultRrdDao
extends Object
implements RrdDao, org.springframework.beans.factory.InitializingBean

DefaultRrdDao class.

Version:
$Id: $
Author:
DJ Gregor

Constructor Summary
DefaultRrdDao()
           
 
Method Summary
 void afterPropertiesSet()
          afterPropertiesSet
 InputStream createGraph(String command, File workDir)
          Create an RRD graph with the given command where RRD files are relative to the workDir.
 int getGraphLeftOffset()
          getGraphLeftOffset
 int getGraphRightOffset()
          getGraphRightOffset
 int getGraphTopOffsetWithText()
          getGraphTopOffsetWithText
 Double 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)
          getPrintValues
 File getRrdBaseDirectory()
          getRrdBaseDirectory
 String getRrdBinaryPath()
          getRrdBinaryPath
 RrdStrategy getRrdStrategy()
          getRrdStrategy
 void setRrdBaseDirectory(File rrdBaseDirectory)
          setRrdBaseDirectory
 void setRrdBinaryPath(String rrdBinaryPath)
          setRrdBinaryPath
 void setRrdStrategy(RrdStrategy rrdStrategy)
          setRrdStrategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRrdDao

public DefaultRrdDao()
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 interface RrdDao
Parameters:
attribute - the attribute
cf - consolidation function (usually "AVERAGE")
start - start time in milliseconds
end - 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 interface RrdDao
Parameters:
attribute - a OnmsAttribute object.
rraConsolidationFunction - a String object.
startTimeInMillis - a long.
endTimeInMillis - a long.
printFunctions - a String object.
Returns:
an array of double.

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

afterPropertiesSet

Specified by:
afterPropertiesSet in interface org.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 - a RrdStrategy object.

getRrdBaseDirectory

public File getRrdBaseDirectory()

getRrdBaseDirectory

Returns:
a File object.

setRrdBaseDirectory

public void setRrdBaseDirectory(File rrdBaseDirectory)

setRrdBaseDirectory

Parameters:
rrdBaseDirectory - a File object.

getRrdBinaryPath

public String getRrdBinaryPath()

getRrdBinaryPath

Returns:
a String object.

setRrdBinaryPath

public void setRrdBinaryPath(String rrdBinaryPath)

setRrdBinaryPath

Parameters:
rrdBinaryPath - a String object.

createGraph

public InputStream createGraph(String command,
                               File workDir)
                        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 interface RrdDao
Parameters:
command - RRD graph command
workDir - RRD files are relative to this directory
Returns:
PNG graph image
Throws:
org.springframework.dao.DataRetrievalFailureException
See Also:
RrdDao.createGraph(java.lang.String, java.io.File)

getGraphTopOffsetWithText

public int getGraphTopOffsetWithText()

getGraphTopOffsetWithText

Specified by:
getGraphTopOffsetWithText in interface RrdDao
Returns:
a int.
See Also:
RrdDao.getGraphTopOffsetWithText()

getGraphLeftOffset

public int getGraphLeftOffset()

getGraphLeftOffset

Specified by:
getGraphLeftOffset in interface RrdDao
Returns:
a int.
See Also:
RrdDao.getGraphLeftOffset()

getGraphRightOffset

public int getGraphRightOffset()

getGraphRightOffset

Specified by:
getGraphRightOffset in interface RrdDao
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 interface RrdDao
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 interface RrdDao
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


Copyright © 2011. All Rights Reserved.