Class MeasurementsWrapper
- java.lang.Object
-
- org.opennms.features.topology.api.info.MeasurementsWrapper
-
public class MeasurementsWrapper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MeasurementsWrapper(MeasurementsService measurementsService)
-
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.
-
-
-
Constructor Detail
-
MeasurementsWrapper
public MeasurementsWrapper(MeasurementsService measurementsService)
-
-
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 usedattribute
- 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 usedattribute
- the attribute to query foraggregation
- 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 usedattribute
- the attribute to query forstart
- the start timestampend
- the end timestampstep
- the step sizeaggregation
- 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 usedifName
- 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 computedstart
- the start timestampend
- the end timestampstep
- the step sizeaggregation
- the aggregation function- Returns:
- a list containing two double values for the in/out percentage utilization
- Throws:
MeasurementException
-
query
public QueryResponse query(QueryRequest request) throws MeasurementException
Method to query the Measurements Api.- Parameters:
request
- the request instance- Returns:
- the response instance
- Throws:
java.lang.Exception
MeasurementException
-
-