protected void closeOutagesForService(final Event event, final Long nodeId, final Date closeDate, final Service polledService) { getPoller().getQueryManager().closeOutagesForService(closeDate, event.getDbid(), nodeId.intValue(), polledService.getAddress(), polledService.getServiceName()); }
LOG.debug("init: Closing outages for unmanaged services"); m_queryManager.closeOutagesForUnmanagedServices(); } catch (Throwable e) { LOG.error("init: Failed to close ouates for unmanage services", e);
private void serviceReschedule(Event event, boolean rescheduleExisting) { final Long nodeId = event.getNodeid(); if (nodeId == null || nodeId <= 0) { LOG.warn("Invalid node ID for event, skipping service reschedule: {}", event); return; } String nodeLabel = EventUtils.getParm(event, EventConstants.PARM_NODE_LABEL); try { nodeLabel = getPoller().getQueryManager().getNodeLabel(nodeId.intValue()); } catch (final Exception e) { LOG.error("Unable to retrieve nodeLabel for node {}", nodeId, e); } String nodeLocation = null; try { nodeLocation = getPoller().getQueryManager().getNodeLocation(nodeId.intValue()); } catch (final Exception e) { LOG.error("Unable to retrieve nodeLocation for node {}", nodeId, e); } getPollerConfig().rebuildPackageIpListMap(); serviceReschedule(nodeId, nodeLabel, nodeLocation, event, rescheduleExisting); }
for (final String[] s : getPoller().getQueryManager().getNodeServices(nodeId.intValue())) { databaseServices.add(new Service(s));
private String getNodeLabel(int nodeId) { String nodeLabel = null; try { nodeLabel = getQueryManager().getNodeLabel(nodeId); } catch (SQLException sqlE) { // Log a warning LOG.warn("Failed to retrieve node label for nodeid {}", nodeId, sqlE); } if (nodeLabel == null) { // This should never happen but if it does just // use nodeId for the nodeLabel so that the // event description has something to display. nodeLabel = String.valueOf(nodeId); } return nodeLabel; }
@Override public void run() { final int eventId = svcLostEvent.getEventId(); if (eventId > 0) { getQueryManager().updateOpenOutageWithEventId(outageId, eventId); } else { LOG.warn("run: Failed to determine an eventId for service lost for: {} with event: {}", svc, svcLostEvent); } } };
getPoller().getQueryManager().closeOutagesForNode(closeDate, event.getDbid(), nodeId.intValue());
getPoller().getQueryManager().closeOutagesForInterface(closeDate, event.getDbid(), nodeId.intValue(), str(ipAddr));
/** {@inheritDoc} */ @Override public void openOutage(final PollableService svc, final PollEvent svcLostEvent) { // Open the outage immediately final Integer outageId = getQueryManager().openOutagePendingLostEventId(svc.getNodeId(), svc.getIpAddr(), svc.getSvcName(), svcLostEvent.getDate()); // Defer updating the outage with the event id until we receive back // from the event bus final Runnable r = new Runnable() { @Override public void run() { final int eventId = svcLostEvent.getEventId(); if (eventId > 0) { getQueryManager().updateOpenOutageWithEventId(outageId, eventId); } else { LOG.warn("run: Failed to determine an eventId for service lost for: {} with event: {}", svc, svcLostEvent); } } }; if (svcLostEvent instanceof PendingPollEvent) { ((PendingPollEvent)svcLostEvent).addPending(r); } else { r.run(); } LOG.debug("openOutage: sending outageCreated event for: {} on {}", svc.getSvcName(), svc.getIpAddr()); sendEvent(createEvent(EventConstants.OUTAGE_CREATED_EVENT_UEI, svc.getNodeId(), svc.getAddress(), svc.getSvcName(), svcLostEvent.getDate(), null)); }
public void resolveOutage(final PollableService svc, final PollEvent svcRegainEvent) { final Integer outageId = getQueryManager().resolveOutagePendingRegainEventId(svc.getNodeId(), svc.getIpAddr(), svc.getSvcName(), svcRegainEvent.getDate());
@Test public void testGetNodeServices() { List<String[]> services = m_queryManager.getNodeServices(1); assertEquals(4, services.size()); for (String[] findMe : new String[][] { services = m_queryManager.getNodeServices(2); assertEquals(2, services.size()); for (String[] findMe : new String[][] { services = m_queryManager.getNodeServices(3); assertEquals(4, services.size()); for (String[] findMe : new String[][] {
private void rescheduleAllServices(Event event) { LOG.info("Poller configuration has been changed, rescheduling services."); getPollerConfig().rebuildPackageIpListMap(); for (Long nodeId : getNetwork().getNodeIds()) { String nodeLabel = null; try { nodeLabel = getPoller().getQueryManager().getNodeLabel(nodeId.intValue()); } catch (final Exception e) { LOG.error("Unable to retrieve nodeLabel for node {}", nodeId, e); } String nodeLocation = null; try { nodeLocation = getPoller().getQueryManager().getNodeLocation(nodeId.intValue()); } catch (final Exception e) { LOG.error("Unable to retrieve nodeLocation for node {}", nodeId, e); } serviceReschedule(nodeId, nodeLabel, nodeLocation, event, true); } }
/** * <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(); }
nodeLabel = getPoller().getQueryManager().getNodeLabel(nodeId.intValue()); } catch (final Exception e) { LOG.error("Unable to retrieve nodeLabel for node {}", nodeId, e); nodeLocation = getPoller().getQueryManager().getNodeLocation(nodeId.intValue()); } catch (final Exception e) { LOG.error("Unable to retrieve nodeLocation for node {}", nodeId, e);