Class DefaultRrdDao

  • All Implemented Interfaces:
    RrdDao, org.springframework.beans.factory.InitializingBean

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

    DefaultRrdDao class.

    Version:
    $Id: $
    Author:
    DJ Gregor
    • Constructor Detail

      • DefaultRrdDao

        public DefaultRrdDao()
    • Method Detail

      • getPrintValue

        public double getPrintValue​(OnmsAttribute attribute,
                                    java.lang.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,
                                       java.lang.String rraConsolidationFunction,
                                       long startTimeInMillis,
                                       long endTimeInMillis,
                                       java.lang.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 java.lang.Exception

        afterPropertiesSet

        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception - if any.
      • setRrdStrategy

        public void setRrdStrategy​(RrdStrategy<?,​?> rrdStrategy)

        setRrdStrategy

        Parameters:
        rrdStrategy - a RrdStrategy object.
      • getRrdBaseDirectory

        public java.io.File getRrdBaseDirectory()

        getRrdBaseDirectory

        Returns:
        a File object.
      • setRrdBaseDirectory

        public void setRrdBaseDirectory​(java.io.File rrdBaseDirectory)

        setRrdBaseDirectory

        Parameters:
        rrdBaseDirectory - a File object.
      • getRrdBinaryPath

        public java.lang.String getRrdBinaryPath()

        getRrdBinaryPath

        Returns:
        a String object.
      • setRrdBinaryPath

        public void setRrdBinaryPath​(java.lang.String rrdBinaryPath)

        setRrdBinaryPath

        Parameters:
        rrdBinaryPath - a String object.
      • createGraph

        public java.io.InputStream createGraph​(java.lang.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 interface RrdDao
        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)
      • getLastFetchValue

        public java.lang.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 java.lang.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