/** * 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. * * @param node the node to be used * @param ifName the inteface of the node * @return the in/out percentage utilization encapsulated in a list */ public List<Double> computeUtilization(final OnmsNode node, final String ifName) throws MeasurementException { long end = System.currentTimeMillis(); long start = end - (15 * 60 * 1000); for(OnmsSnmpInterface snmpInterface : node.getSnmpInterfaces()) { if (ifName.equals(snmpInterface.getIfName())) { String resourceId = "node[" + node.getId() + "].interfaceSnmp[" + snmpInterface.computeLabelForRRD() + "]"; return computeUtilization(resourceId, start, end, 300000, "AVERAGE"); } } return Arrays.asList(Double.NaN, Double.NaN); }
/** * 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. * * @param node the node to be used * @param ifName the inteface of the node * @return the in/out percentage utilization encapsulated in a list */ public List<Double> computeUtilization(final OnmsNode node, final String ifName) throws MeasurementException { long end = System.currentTimeMillis(); long start = end - (15 * 60 * 1000); for(OnmsSnmpInterface snmpInterface : node.getSnmpInterfaces()) { if (ifName.equals(snmpInterface.getIfName())) { String resourceId = "node[" + node.getId() + "].interfaceSnmp[" + snmpInterface.computeLabelForRRD() + "]"; return computeUtilization(resourceId, start, end, 300000, "AVERAGE"); } } return Arrays.asList(Double.NaN, Double.NaN); }