/** {@inheritDoc} */ @Transactional @Override public OnmsMonitoredService addMonitoredService(final Integer ipInterfaceId, final String svcName) { final OnmsIpInterface iface = m_ipInterfaceDao.get(ipInterfaceId); assertNotNull(iface, "could not find interface with id %d", ipInterfaceId); return addMonitoredService(iface, svcName); }
/** {@inheritDoc} */ @Transactional @Override public OnmsMonitoredService addMonitoredService(final Integer ipInterfaceId, final String svcName) { final OnmsIpInterface iface = m_ipInterfaceDao.get(ipInterfaceId); assertNotNull(iface, "could not find interface with id %d", ipInterfaceId); return addMonitoredService(iface, svcName); }
private void updateParent(final OnmsMonitoredService svc) { if (svc.getIpInterface() != null && svc.getIpInterface().getId() != null) { final OnmsIpInterface iface = getIpInterfaceDao().get(svc.getIpInterface().getId()); if (iface != null && iface != svc.getIpInterface()) { LOG.debug("merging interface {} into interface {}", svc.getIpInterface(), iface); iface.mergeInterface(svc.getIpInterface(), new NullEventForwarder(), false); svc.setIpInterface(iface); } if (!svc.getIpInterface().getMonitoredServices().contains(svc)) { svc.getIpInterface().addMonitoredService(svc); } } }
private void updateParent(final OnmsMonitoredService svc) { if (svc.getIpInterface() != null && svc.getIpInterface().getId() != null) { final OnmsIpInterface iface = getIpInterfaceDao().get(svc.getIpInterface().getId()); if (iface != null && iface != svc.getIpInterface()) { LOG.debug("merging interface {} into interface {}", svc.getIpInterface(), iface); iface.mergeInterface(svc.getIpInterface(), new NullEventForwarder(), false); svc.setIpInterface(iface); } if (!svc.getIpInterface().getMonitoredServices().contains(svc)) { svc.getIpInterface().addMonitoredService(svc); } } }
@Override public OnmsResource getChildByName(OnmsResource parent, String ipAddress) { // Grab the node entity final OnmsNode node = ResourceTypeUtils.getNodeFromResource(parent); // Determine the location name final String locationName = MonitoringLocationUtils.getLocationNameOrNullIfDefault(node); // Grab the interface final OnmsIpInterface matchingIf = m_ipInterfaceDao.get(node, ipAddress); if (matchingIf == null) { throw new ObjectRetrievalFailureException(OnmsIpInterface.class, "No interface with ipAddr " + ipAddress + " could be found on node with id " + node.getId()); } // Verify the path final ResourcePath path = getInterfacePath(locationName, ipAddress); if (!m_resourceStorageDao.exists(path, 0)) { throw new ObjectRetrievalFailureException(OnmsResource.class, "No metrics found in parent path '" + parent.getPath() + "'"); } // Create the resource final OnmsResource resource = createResource(locationName, matchingIf, ipAddress, path); resource.setParent(parent); return resource; }