/** * Send a newSuspect event for the interface construct event with 'linkd' as source * * @param ipInterface The interface for which the newSuspect event is to be generated * @param ipowner The host that hold this ipInterface information * @pkgName The package Name of the ready runnable involved */ void sendNewSuspectEvent(InetAddress ipaddress, InetAddress ipowner, String pkgName) { if (m_newSuspectEventsIpAddr.contains(ipaddress)) { LogUtils.infof( this, "sendNewSuspectEvent: nothing to send, suspect event previously sent for IP address: %s", str(ipaddress)); return; } else if (!isInterfaceInPackageRange(ipaddress, pkgName)) { LogUtils.infof( this, "sendNewSuspectEvent: nothing to send for IP address: %s, not in package: %s", str(ipaddress), pkgName); return; } org.opennms.netmgt.config.linkd.Package pkg = m_linkdConfig.getPackage(pkgName); boolean autodiscovery = false; if (pkg.hasAutoDiscovery()) autodiscovery = pkg.getAutoDiscovery(); else autodiscovery = m_linkdConfig.isAutoDiscoveryEnabled(); if (autodiscovery) { EventBuilder bldr = new EventBuilder(EventConstants.NEW_SUSPECT_INTERFACE_EVENT_UEI, "linkd"); bldr.setHost(str(ipowner)); bldr.setInterface(ipaddress); m_eventForwarder.sendNow(bldr.getEvent()); m_newSuspectEventsIpAddr.add(ipaddress); } }
void completed() { if (!isAborted()) { final EventBuilder bldr = new EventBuilder( EventConstants.REINITIALIZE_PRIMARY_SNMP_INTERFACE_EVENT_UEI, "Provisiond"); bldr.setNodeid(getNodeId()); bldr.setInterface(getAgentAddress()); getEventForwarder().sendNow(bldr.getEvent()); } }
/** {@inheritDoc} */ public void poll(OnmsMonitoredService monSvc, int pollResultId) { EventBuilder bldr = new EventBuilder(EventConstants.DEMAND_POLL_SERVICE_EVENT_UEI, "PollerService"); bldr.setNodeid(monSvc.getNodeId()); bldr.setInterface(monSvc.getIpAddress()); bldr.setIfIndex(monSvc.getIfIndex()); bldr.setService(monSvc.getServiceType().getName()); bldr.addParam(EventConstants.PARM_DEMAND_POLL_ID, pollResultId); sendEvent(bldr.getEvent()); }
private void sendNewSuspectEvent(InetAddress address, Long rtt, String foreignSource) { EventBuilder eb = new EventBuilder(EventConstants.NEW_SUSPECT_INTERFACE_EVENT_UEI, "OpenNMS.Discovery"); eb.setInterface(address); eb.setHost(InetAddressUtils.getLocalHostName()); eb.addParam("RTT", rtt); if (foreignSource != null) { eb.addParam("foreignSource", foreignSource); } try { m_ipc_manager.sendNow(eb.getEvent()); LOG.debug("Sent event: {}", EventConstants.NEW_SUSPECT_INTERFACE_EVENT_UEI); } catch (Throwable t) { LOG.warn("run: unexpected throwable exception caught during send to middleware", t); } }