Class MeasurementsWrapper


  • public class MeasurementsWrapper
    extends Object
    • Constructor Detail

    • Method Detail

      • getLastValue

        public double getLastValue​(String resource,
                                   String attribute)
                            throws MeasurementException
        Queries the Measuement Api for the last value found in a given timeframe.
        Parameters:
        resource - the resource to be used
        attribute - the attribute to query for
        Returns:
        the last known value
        Throws:
        MeasurementException
      • getLastValue

        public double getLastValue​(String resource,
                                   String attribute,
                                   String aggregation)
                            throws MeasurementException
        Queries the Measurement Api for the last value found in a given timeframe.
        Parameters:
        resource - the resource to be used
        attribute - the attribute to query for
        aggregation - the aggregation method
        Returns:
        the last known value
        Throws:
        MeasurementException
      • query

        public List<Double> query​(String resource,
                                  String attribute,
                                  long start,
                                  long end,
                                  long step,
                                  String aggregation,
                                  boolean relaxed)
                           throws MeasurementException
        A method to query the Measurements Api for a given resource/attribute.
        Parameters:
        resource - the resource to be used
        attribute - the attribute to query for
        start - the start timestamp
        end - the end timestamp
        step - the step size
        aggregation - the aggregation method
        Returns:
        the list of double values
        Throws:
        MeasurementException
      • computeUtilization

        public List<Double> computeUtilization​(OnmsNode node,
                                               String ifName)
                                        throws MeasurementException
        This method computes the utilization of a given interface resource. The method returns two double values encapsulated in a list. It uses the HC attributes for the computation and non-HC as fallback attributes.
        Parameters:
        node - the node to be used
        ifName - the inteface of the node
        Returns:
        the in/out percentage utilization encapsulated in a list
        Throws:
        MeasurementException
      • computeUtilization

        public List<Double> computeUtilization​(String resource,
                                               long start,
                                               long end,
                                               long step,
                                               String aggregation)
                                        throws MeasurementException
        This method computes the utilization of a given interface resource. The method returns two double values encapsulated in a list. It uses the HC attributes for the computation and non-HC as fallback attributes.
        Parameters:
        resource - the resource for which the utilization must be computed
        start - the start timestamp
        end - the end timestamp
        step - the step size
        aggregation - the aggregation function
        Returns:
        a list containing two double values for the in/out percentage utilization
        Throws:
        MeasurementException