Class MeasurementsWrapper


  • public class MeasurementsWrapper
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.Double> computeUtilization​(java.lang.String resource, long start, long end, long step, java.lang.String aggregation)
      This method computes the utilization of a given interface resource.
      java.util.List<java.lang.Double> computeUtilization​(OnmsNode node, java.lang.String ifName)
      This method computes the utilization of a given interface resource.
      double getLastValue​(java.lang.String resource, java.lang.String attribute)
      Queries the Measuement Api for the last value found in a given timeframe.
      double getLastValue​(java.lang.String resource, java.lang.String attribute, java.lang.String aggregation)
      Queries the Measurement Api for the last value found in a given timeframe.
      double getLastValue​(java.lang.String resource, java.lang.String attribute, java.lang.String aggregation, boolean relaxed)  
      java.util.List<java.lang.Double> query​(java.lang.String resource, java.lang.String attribute, long start, long end, long step, java.lang.String aggregation, boolean relaxed)
      A method to query the Measurements Api for a given resource/attribute.
      QueryResponse query​(QueryRequest request)
      Method to query the Measurements Api.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getLastValue

        public double getLastValue​(java.lang.String resource,
                                   java.lang.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​(java.lang.String resource,
                                   java.lang.String attribute,
                                   java.lang.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
      • getLastValue

        public double getLastValue​(java.lang.String resource,
                                   java.lang.String attribute,
                                   java.lang.String aggregation,
                                   boolean relaxed)
                            throws MeasurementException
        Throws:
        MeasurementException
      • query

        public java.util.List<java.lang.Double> query​(java.lang.String resource,
                                                      java.lang.String attribute,
                                                      long start,
                                                      long end,
                                                      long step,
                                                      java.lang.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 java.util.List<java.lang.Double> computeUtilization​(OnmsNode node,
                                                                   java.lang.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 java.util.List<java.lang.Double> computeUtilization​(java.lang.String resource,
                                                                   long start,
                                                                   long end,
                                                                   long step,
                                                                   java.lang.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