/** * <p>createNodeGainedServiceEvent</p> * * @param monSvc a {@link org.opennms.netmgt.model.OnmsMonitoredService} object. * @return a {@link org.opennms.netmgt.xml.event.Event} object. */ protected Event createNodeGainedServiceEvent(final OnmsMonitoredService monSvc) { final OnmsIpInterface iface = monSvc.getIpInterface(); final OnmsNode node = iface.getNode(); LOG.debug("ipinterface = {}", iface); LOG.debug("snmpinterface = {}", iface.getSnmpInterface()); LOG.debug("node = {}", node); return EventUtils.createNodeGainedServiceEvent(m_eventSource, monSvc.getNodeId(), iface.getIpAddress(), monSvc.getServiceType().getName(), node.getLabel(), node.getLabelSource(), node.getSysName(), node.getSysDescription()); }
/** {@inheritDoc} */ public void visitMonitoredService(OnmsMonitoredService monSvc) { OnmsIpInterface iface = monSvc.getIpInterface(); OnmsNode node = iface.getNode(); m_events.add(EventUtils.createNodeGainedServiceEvent("ModelImporter", monSvc.getNodeId().intValue(), iface.getIpAddress(), monSvc.getServiceType().getName(), node.getLabel(), node.getLabelSource(), node.getSysName(), node.getSysDescription())); } }
body.put("nodesysname", node.getSysName()); body.put("nodesyslocation", node.getSysLocation()); body.put("foreignsource", node.getForeignSource());
body.put("nodesysname", node.getSysName()); body.put("nodesyslocation", node.getSysLocation()); body.put("foreignsource", node.getForeignSource());
String primarySysName = node.getSysName();
body.put("nodesysname", node.getSysName()); body.put("nodesyslocation", node.getSysLocation()); body.put("foreignsource", node.getForeignSource());
@Override public List<Node> findAllSnmpNode() { final List<Node> nodes = new ArrayList<Node>(); final Criteria criteria = new Criteria(OnmsNode.class); criteria.setAliases(Arrays.asList(new Alias[] { new Alias( "ipInterfaces", "iface", JoinType.LEFT_JOIN) })); criteria.addRestriction(new EqRestriction("type", NodeType.ACTIVE)); criteria.addRestriction(new EqRestriction("iface.isSnmpPrimary", PrimaryType.PRIMARY)); for (final OnmsNode node : m_nodeDao.findMatching(criteria)) { nodes.add(new Node(node.getId(), node.getLabel(), node.getPrimaryInterface().getIpAddress(), node.getSysObjectId(), node.getSysName(),node.getLocation() == null ? null : node.getLocation().getLocationName())); } return nodes; }
/** * <p>mergeAgentAttributes</p> * * @param scannedNode a {@link org.opennms.netmgt.model.OnmsNode} object. */ public void mergeAgentAttributes(OnmsNode scannedNode) { if (hasNewValue(scannedNode.getSysContact(), getSysContact())) { setSysContact(scannedNode.getSysContact()); } if (hasNewValue(scannedNode.getSysDescription(), getSysDescription())) { setSysDescription(scannedNode.getSysDescription()); } if (hasNewValue(scannedNode.getSysLocation(), getSysLocation())) { setSysLocation(scannedNode.getSysLocation()); } if (hasNewValue(scannedNode.getSysName(), getSysName())) { setSysName(scannedNode.getSysName()); } if (hasNewValue(scannedNode.getSysObjectId(), getSysObjectId())) { setSysObjectId(scannedNode.getSysObjectId()); } }
@Override public Node getSnmpNode(final int nodeid) { final Criteria criteria = new Criteria(OnmsNode.class); criteria.setAliases(Arrays.asList(new Alias[] { new Alias( "ipInterfaces", "iface", JoinType.LEFT_JOIN) })); criteria.addRestriction(new EqRestriction("type", NodeType.ACTIVE)); criteria.addRestriction(new EqRestriction("iface.isSnmpPrimary", PrimaryType.PRIMARY)); criteria.addRestriction(new EqRestriction("id", nodeid)); final List<OnmsNode> nodes = m_nodeDao.findMatching(criteria); if (nodes.size() > 0) { final OnmsNode node = nodes.get(0); return new Node(node.getId(), node.getLabel(), node.getPrimaryInterface().getIpAddress(), node.getSysObjectId(), node.getSysName(),node.getLocation() == null ? null : node.getLocation().getLocationName()); } else { return null; } }
if (!nullSafeEquals(db.getSysName(), imported.getSysName())) { db.setSysName(imported.getSysName());