Example #1
0
 /**
  * loadNode
  *
  * @param loadNode a {@link org.opennms.core.tasks.BatchTask} object.
  */
 public void loadNode(final BatchTask loadNode) {
   if (getForeignSource() != null) {
     m_node = m_provisionService.getRequisitionedNode(getForeignSource(), getForeignId());
     if (m_node == null) {
       abort(
           String.format(
               "Unable to get requisitioned node (%s/%s): aborted", m_foreignSource, m_foreignId));
     } else {
       for (final OnmsIpInterface iface : m_node.getIpInterfaces()) {
         loadNode.add(
             new IpInterfaceScan(
                 getNodeId(), iface.getIpAddress(), getForeignSource(), getProvisionService()));
       }
     }
   } else {
     m_node = m_provisionService.getNode(m_nodeId);
   }
 }
Example #2
0
  /**
   * detectAgents
   *
   * @param currentPhase a {@link org.opennms.core.tasks.BatchTask} object.
   */
  public void detectAgents(final BatchTask currentPhase) {

    if (!isAborted()) {
      final OnmsNode node = getNode();
      final OnmsIpInterface primaryIface = m_provisionService.getPrimaryInterfaceForNode(node);
      if (primaryIface != null && primaryIface.getMonitoredServiceByServiceType("SNMP") != null) {
        LOG.debug(
            "Found primary interface and SNMP service for node {}/{}/{}",
            node.getId(),
            node.getForeignSource(),
            node.getForeignId());
        onAgentFound(currentPhase, primaryIface);
      } else {
        LOG.debug(
            "Failed to locate primary interface and SNMP service for node {}/{}/{}",
            node.getId(),
            node.getForeignSource(),
            node.getForeignId());
      }
    }
  }