org.opennms.netmgt.xml.event.Event.getInterfaceAddress()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(187)

本文整理了Java中org.opennms.netmgt.xml.event.Event.getInterfaceAddress()方法的一些代码示例,展示了Event.getInterfaceAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getInterfaceAddress()方法的具体详情如下:
包路径:org.opennms.netmgt.xml.event.Event
类名称:Event
方法名:getInterfaceAddress

Event.getInterfaceAddress介绍

暂无

代码示例

代码示例来源:origin: OpenNMS/opennms

@Override
  public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) {
    InetAddress addr = event.getInterfaceAddress();
    if (addr != null) {
      return addr.getHostName();
    }
    return null;
  }
},

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

@Override
  public String getValue(String parm, String parsedParm, Event event, EventUtil eventUtil) {
    InetAddress addr = event.getInterfaceAddress();
    if (addr != null) {
      return addr.getHostName();
    }
    return null;
  }
},

代码示例来源:origin: OpenNMS/opennms

/**
 * <p>handleDeleteService</p>
 *
 * @param event a {@link org.opennms.netmgt.xml.event.Event} object.
 */
@EventHandler(uei=EventConstants.DELETE_SERVICE_EVENT_UEI)
public void handleDeleteService(Event event) {
  try {
  doDeleteService(event.getNodeid(), event.getInterfaceAddress() == null ? null : event.getInterfaceAddress(), event.getService());
  } catch (Throwable e) {
    LOG.error("Unexpected exception processing event: {}", event.getUei(), e);
  }
}

代码示例来源:origin: org.opennms/opennms-provisiond

/**
 * <p>handleDeleteService</p>
 *
 * @param event a {@link org.opennms.netmgt.xml.event.Event} object.
 */
@EventHandler(uei=EventConstants.DELETE_SERVICE_EVENT_UEI)
public void handleDeleteService(Event event) {
  try {
  doDeleteService(event.getNodeid(), event.getInterfaceAddress() == null ? null : event.getInterfaceAddress(), event.getService());
  } catch (Throwable e) {
    LOG.error("Unexpected exception processing event: {}", event.getUei(), e);
  }
}

代码示例来源:origin: OpenNMS/opennms

@EventHandler(uei=EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI)
@Transactional
public void handleNodeGainedInterface(Event event) {
  LOG.debug("Received event: {}", event.getUei());
  Long nodeId = event.getNodeid();
  if (nodeId == null) {
    LOG.error(EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI + ": Event with no node ID: " + event.toString());
    return;
  }
  OnmsNode node = m_nodeDao.get(nodeId.intValue());
  if (node == null) {
    LOG.warn(EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI + ": Cannot find node in DB: " + nodeId);
    return;
  }
  // add to known nodes
  m_cache.setNodeId(node.getLocation().getLocationName(), event.getInterfaceAddress(), nodeId.intValue());
}

代码示例来源:origin: OpenNMS/opennms

@EventHandler(uei=EventConstants.INTERFACE_DELETED_EVENT_UEI)
@Transactional
public void handleInterfaceDeleted(Event event) {
  LOG.debug("Received event: {}", event.getUei());
  Long nodeId = event.getNodeid();
  if (nodeId == null) {
    LOG.error(EventConstants.INTERFACE_DELETED_EVENT_UEI + ": Event with no node ID: " + event.toString());
    return;
  }
  OnmsNode node = m_nodeDao.get(nodeId.intValue());
  if (node == null) {
    LOG.warn(EventConstants.INTERFACE_DELETED_EVENT_UEI + ": Cannot find node in DB: " + nodeId);
    return;
  }
  // remove from known nodes
  m_cache.removeNodeId(node.getLocation().getLocationName(), event.getInterfaceAddress(), nodeId.intValue());
}

代码示例来源:origin: OpenNMS/opennms

/**
 * This method is responsible for removing a node's pollable service from
 * the pollable services list
 */
private void nodeRemovePollableServiceHandler(Event event) {
  Long nodeId = event.getNodeid();
  InetAddress ipAddr = event.getInterfaceAddress();
  String svcName = event.getService();
  if (svcName == null) {
    LOG.error("nodeRemovePollableServiceHandler: service name is null, ignoring event");
    return;
  }
  PollableService svc = getNetwork().getService(nodeId.intValue(), ipAddr, svcName);
  svc.delete();
}

代码示例来源:origin: OpenNMS/opennms

if (event.getInterfaceAddress() == null)
  return;
InetAddress ipAddr = event.getInterfaceAddress();

代码示例来源:origin: OpenNMS/opennms

InetAddress ip = m_event.getInterfaceAddress();

代码示例来源:origin: OpenNMS/opennms

body.put("dom", Integer.toString(cal.get(Calendar.DAY_OF_MONTH)));
body.put("eventsource", event.getSource());
body.put("ipaddr", event.getInterfaceAddress()!=null ? event.getInterfaceAddress().toString() : null );
body.put("servicename", event.getService());

代码示例来源:origin: org.opennms.features/org.opennms.features.opennms-es-rest

body.put("dom", Integer.toString(cal.get(Calendar.DAY_OF_MONTH)));
body.put("eventsource", event.getSource());
body.put("ipaddr", event.getInterfaceAddress()!=null ? event.getInterfaceAddress().toString() : null );
body.put("servicename", event.getService());

代码示例来源:origin: OpenNMS/opennms

private void interfaceDeletedHandler(Event event) {
  Long nodeId = event.getNodeid();
  String sourceUei = event.getUei();
  InetAddress ipAddr = event.getInterfaceAddress();

代码示例来源:origin: OpenNMS/opennms

m_cache.removeNodeId(oldNode.getLocation().getLocationName(), event.getInterfaceAddress(), oldNode.getId());
m_cache.setNodeId(newNode.getLocation().getLocationName(), event.getInterfaceAddress(), newNode.getId());

代码示例来源:origin: OpenNMS/opennms

/**
 * <p>
 * This method remove a deleted service from the pollable service list of
 * the specified interface, so that it will not be scheduled by the poller.
 * </p>
 */
private void serviceDeletedHandler(Event event) {
  Long nodeId = event.getNodeid();
  InetAddress ipAddr = event.getInterfaceAddress();
  String service = event.getService();
  Date closeDate = event.getTime();
  getPoller().getQueryManager().closeOutagesForService(closeDate, event.getDbid(), nodeId.intValue(), str(ipAddr), service);
  PollableService svc = getNetwork().getService(nodeId.intValue(), ipAddr, service);
  if (svc == null) {
    LOG.error("Interface {}/{} does not exist in pollable node map, unable to delete node.", nodeId, event.getInterface());
    return;
  }
  svc.delete();
}

代码示例来源:origin: OpenNMS/opennms

retVal = InetAddressUtils.toInteger(e1.getInterfaceAddress()).compareTo(InetAddressUtils.toInteger(e2.getInterfaceAddress()));

代码示例来源:origin: OpenNMS/opennms

retVal = InetAddressUtils.toInteger(e1.getInterfaceAddress()).compareTo(InetAddressUtils.toInteger(e2.getInterfaceAddress()));

代码示例来源:origin: OpenNMS/opennms

oe.setEventForward((event.getForwardCount() > 0) ? org.opennms.netmgt.dao.util.Forward.format(event.getForward(), EVENT_FORWARD_FIELD_SIZE) : null);
oe.setIfIndex(event.getIfIndex());
oe.setIpAddr(event.getInterfaceAddress());

代码示例来源:origin: org.opennms/opennms-dao-mock

oe.setEventForward((event.getForwardCount() > 0) ? org.opennms.netmgt.dao.util.Forward.format(event.getForward(), EVENT_FORWARD_FIELD_SIZE) : null);
oe.setIfIndex(event.getIfIndex());
oe.setIpAddr(event.getInterfaceAddress());

代码示例来源:origin: OpenNMS/opennms

@Test
public void testNullInterfaceOnNodeDown() {
  // NODE processing = true;
  m_pollerConfig.setNodeOutageProcessingEnabled(true);
  MockNode node = m_network.getNode(2);
  MockService icmpService = m_network.getService(2, "192.168.1.3", "ICMP");
  MockService smtpService = m_network.getService(2, "192.168.1.3", "SMTP");
  MockService snmpService = m_network.getService(2, "192.168.1.3", "SNMP");
  // start the poller
  startDaemons();
  anticipateDown(node);
  icmpService.bringDown();
  smtpService.bringDown();
  snmpService.bringDown();
  verifyAnticipated(10000);
  // node is down at this point
  boolean foundNodeDown = false;
  for (final Event event : m_eventMgr.getEventAnticipator().getAnticipatedEventsReceived()) {
    if (EventConstants.NODE_DOWN_EVENT_UEI.equals(event.getUei())) {
      foundNodeDown = true;
      assertNull(event.getInterfaceAddress());
    }
  }
  assertTrue(foundNodeDown);
}

代码示例来源:origin: OpenNMS/opennms

@Test
public void testNullInterfaceOnNodeDown() {
  // NODE processing = true;
  m_pollerConfig.setNodeOutageProcessingEnabled(true);
  MockNode node = m_network.getNode(2);
  MockService icmpService = m_network.getService(2, "192.168.1.3", "ICMP");
  MockService smtpService = m_network.getService(2, "192.168.1.3", "SMTP");
  MockService snmpService = m_network.getService(2, "192.168.1.3", "SNMP");
  // start the poller
  startDaemons();
  anticipateDown(node);
  icmpService.bringDown();
  smtpService.bringDown();
  snmpService.bringDown();
  verifyAnticipated(10000);
  // node is down at this point
  boolean foundNodeDown = false;
  for (final Event event : m_eventMgr.getEventAnticipator().getAnticipatedEventsReceived()) {
    if (EventConstants.NODE_DOWN_EVENT_UEI.equals(event.getUei())) {
      foundNodeDown = true;
      assertNull(event.getInterfaceAddress());
    }
  }
  assertTrue(foundNodeDown);
}

相关文章