@Override public CollectionAgent doInTransaction(TransactionStatus status) { final OnmsNode node = Iterables.getFirst(nodeDao.findByLabel(jtiMsg.getSystemId()), null); if (node != null) { final OnmsIpInterface primaryInterface = node.getPrimaryInterface(); return collectionAgentFactory.createCollectionAgent(primaryInterface); } return null; } });
private CollectionAgent getCollectionAgent() { final InetAddress hostAddr = InetAddrUtils.addr(host); if (nodeCriteria != null) { return collectionAgentFactory.createCollectionAgentAndOverrideLocation(nodeCriteria, hostAddr, location); } else { System.out.println("NOTE: Some collectors require a database node and IP interface.\n"); final CollectionAgentDTO agent = new CollectionAgentDTO(); agent.setLocationName(location); agent.setAddress(hostAddr); agent.setStorageResourcePath(ResourcePath.fromString("")); return agent; } }
@Override public CollectionAgent doInTransaction(TransactionStatus status) { OnmsNode node = Iterables.getFirst(nodeDao.findByLabelForLocation(msg.getNodeIdStr(), messageLog.getLocation()), null); if (node == null) { // If there is no matching label , Try matching with foreignId node = Iterables.getFirst(nodeDao.findByForeignIdForLocation(msg.getNodeIdStr(), messageLog.getLocation()), null); } if (node != null) { final OnmsIpInterface primaryInterface = node.getPrimaryInterface(); return collectionAgentFactory.createCollectionAgent(primaryInterface); } return null; } });
if (nodeId.isPresent()) { agent = collectionAgentFactory.createCollectionAgent(Integer.toString(nodeId.get()), inetAddress);
agent = collectionAgentFactory.createCollectionAgent(Integer.toString(nodeId.get()), inetAddress);
agent = collectionAgentFactory.createCollectionAgent(Integer.toString(nodeId.get()), inetAddress);