public InterfaceBuilder setIsManaged(final String managed) { m_iface.setIsManaged(managed); return this; }
case MANAGE: LOG.debug("Managing {} according to policy", iface); iface.setIsManaged("M"); return iface; case UNMANAGE: LOG.debug("Unmanaging {} according to policy", iface); iface.setIsManaged("U"); return iface; case ENABLE_SNMP_POLL:
iface.setIsManaged("M");
/** * @param ipAddr * @param nodeLabel */ private void doAddNode(String ipAddr, String nodeLabel) { OnmsNode node = new OnmsNode(); node.setLabel(nodeLabel); OnmsIpInterface iface = new OnmsIpInterface(addr(ipAddr), node); iface.setIsManaged("M"); iface.setPrimaryString("N"); m_provisionService.insertNode(node); }
/** * @param ipAddr * @param nodeLabel */ private void doAddNode(String ipAddr, String nodeLabel) { OnmsNode node = new OnmsNode(); node.setLabel(nodeLabel); OnmsIpInterface iface = new OnmsIpInterface(addr(ipAddr), node); iface.setIsManaged("M"); iface.setPrimaryString("N"); m_provisionService.insertNode(node); }
iface.setIsManaged("M");
m_currentInterface.setIsManaged(status == 3 ? "U" : "M"); m_currentInterface.setIsSnmpPrimary(primaryType);
m_currentInterface.setIsManaged(status == 3 ? "U" : "M"); m_currentInterface.setIsSnmpPrimary(primaryType);
/** {@inheritDoc} */ public void foundInterface(final String ipAddr, final Object descr, final InterfaceSnmpPrimaryType snmpPrimary, final boolean managed, final int status) { if ("".equals(ipAddr)) { log().error("Found interface on node "+m_node.getLabel()+" with an empty ipaddr! Ignoring!"); // create a bogus OnmsIpInterface and set it to current to services we run across get ignored as well m_currentInterface = new OnmsIpInterface(); return; } m_currentInterface = new OnmsIpInterface(ipAddr, m_node); m_currentInterface.setIsManaged(status == 3 ? "U" : "M"); m_currentInterface.setIsSnmpPrimary(PrimaryType.get(snmpPrimary.toString())); //m_currentInterface.setIpStatus(status == 3 ? new Integer(3) : new Integer(1)); if (InterfaceSnmpPrimaryType.P.equals(snmpPrimary)) { final InetAddress addr = InetAddressUtils.addr(ipAddr); if (addr == null) { LogUtils.errorf(this, "Unable to resolve address of snmpPrimary interface for node %s", m_node.getLabel()); } m_collector = new IfSnmpCollector(addr); } //FIXME: verify this doesn't conflict with constructor. The constructor already adds this //interface to the node. m_node.addIpInterface(m_currentInterface); }
iface.setIsManaged("M");
@Override protected OnmsNode doInsert() { final Date now = new Date(); OnmsMonitoringLocation location = createLocationIfNecessary(locationString); // Associate the location with the node final OnmsNode node = new OnmsNode(location); final String hostname = getHostnameResolver().getHostname(addr(ipAddress), locationString); if (hostname == null || ipAddress.equals(hostname)) { node.setLabel(ipAddress); node.setLabelSource(NodeLabelSource.ADDRESS); } else { node.setLabel(hostname); node.setLabelSource(NodeLabelSource.HOSTNAME); } node.setForeignSource(effectiveForeignSource); node.setType(NodeType.ACTIVE); node.setLastCapsdPoll(now); final OnmsIpInterface iface = new OnmsIpInterface(InetAddressUtils.addr(ipAddress), node); iface.setIsManaged("M"); iface.setIpHostName(hostname); iface.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); iface.setIpLastCapsdPoll(now); m_nodeDao.save(node); m_nodeDao.flush(); return node; } }.execute();
@Override protected OnmsNode doInsert() { final Date now = new Date(); OnmsMonitoringLocation location = createLocationIfNecessary(locationString); // Associate the location with the node final OnmsNode node = new OnmsNode(location); final String hostname = getHostnameResolver().getHostname(addr(ipAddress), locationString); if (hostname == null || ipAddress.equals(hostname)) { node.setLabel(ipAddress); node.setLabelSource(NodeLabelSource.ADDRESS); } else { node.setLabel(hostname); node.setLabelSource(NodeLabelSource.HOSTNAME); } node.setForeignSource(effectiveForeignSource); node.setType(NodeType.ACTIVE); node.setLastCapsdPoll(now); final OnmsIpInterface iface = new OnmsIpInterface(InetAddressUtils.addr(ipAddress), node); iface.setIsManaged("M"); iface.setIpHostName(hostname); iface.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); iface.setIpLastCapsdPoll(now); m_nodeDao.save(node); m_nodeDao.flush(); return node; } }.execute();
private void update(OnmsIpInterface imported, OnmsIpInterface iface, List<Event> events) { if (!nullSafeEquals(iface.getIsManaged(), imported.getIsManaged())) iface.setIsManaged(imported.getIsManaged()); if (!nullSafeEquals(iface.getIsSnmpPrimary(), imported.getIsSnmpPrimary())) { iface.setIsSnmpPrimary(imported.getIsSnmpPrimary()); // TODO: send snmpPrimary event } if (isSnmpDataForInterfacesUpToDate()) { updateSnmpInterface(imported, iface); } if (!nullSafeEquals(iface.getIpHostName(), imported.getIpHostName())) iface.setIpHostName(imported.getIpHostName()); updateServices(iface, imported, events); }
setIsManaged(scannedIface.getIsManaged());