Class MeasurementsWrapper
- java.lang.Object
-
- org.opennms.features.topology.api.info.MeasurementsWrapper
-
public class MeasurementsWrapper extends Object
-
-
Constructor Summary
Constructors Constructor Description MeasurementsWrapper(MeasurementsService measurementsService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Double>
computeUtilization(String resource, long start, long end, long step, String aggregation)
This method computes the utilization of a given interface resource.List<Double>
computeUtilization(OnmsNode node, String ifName)
This method computes the utilization of a given interface resource.double
getLastValue(String resource, String attribute)
Queries the Measuement Api for the last value found in a given timeframe.double
getLastValue(String resource, String attribute, String aggregation)
Queries the Measurement Api for the last value found in a given timeframe.double
getLastValue(String resource, String attribute, String aggregation, boolean relaxed)
List<Double>
query(String resource, String attribute, long start, long end, long step, 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(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 usedattribute
- 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 usedattribute
- the attribute to query foraggregation
- the aggregation method- Returns:
- the last known value
- Throws:
MeasurementException
-
getLastValue
public double getLastValue(String resource, String attribute, String aggregation, boolean relaxed) throws MeasurementException
- 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 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 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 usedifName
- 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 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:
Exception
MeasurementException
-
-