private static void logInitializeSnmpIf(OnmsSnmpInterface snmpIface) { LOG.debug("initialize: snmpifindex = {}, snmpifname = {}, snmpifdescr = {}, snmpphysaddr = -{}-", snmpIface.getIfIndex(), snmpIface.getIfName(), snmpIface.getIfDescr(), snmpIface.getPhysAddr()); LOG.debug("initialize: ifLabel = '{}'", snmpIface.computeLabelForRRD()); }
/** * 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); }
/** * <p>Constructor for SnmpIfData.</p> * * @param snmpIface a {@link org.opennms.netmgt.model.OnmsSnmpInterface} object. */ public SnmpIfData(OnmsSnmpInterface snmpIface) { m_nodeId = nullSafeUnbox(snmpIface.getNode().getId(), -1); m_collectionEnabled = snmpIface.isCollectionEnabled(); m_ifIndex = nullSafeUnbox(snmpIface.getIfIndex(), -1); m_ifType = nullSafeUnbox(snmpIface.getIfType(), -1); m_rrdLabel = snmpIface.computeLabelForRRD(); m_ifAlias = snmpIface.getIfAlias(); m_attributes.put("snmpphysaddr", snmpIface.getPhysAddr()); m_attributes.put("snmpifindex", Integer.toString(m_ifIndex)); m_attributes.put("snmpifdescr", snmpIface.getIfDescr()); m_attributes.put("snmpiftype", Integer.toString(m_ifType)); m_attributes.put("snmpifname", snmpIface.getIfName()); m_attributes.put("snmpifadminstatus", Integer.toString(nullSafeUnbox(snmpIface.getIfAdminStatus(), -1))); m_attributes.put("snmpifoperstatus", Integer.toString(nullSafeUnbox(snmpIface.getIfOperStatus(), -1))); m_attributes.put("snmpifspeed", Long.toString(nullSafeUnbox(snmpIface.getIfSpeed(), -1))); m_attributes.put("snmpifalias", m_ifAlias); }