/** * Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue * calls this method to send alarms to the northern NMS. * * @param alarms the alarms * @throws NorthbounderException the northbounder exception */ @Override public void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException { if (alarms == null) { String errorMsg = "No alarms in alarms list for BSF forwarding."; NorthbounderException e = new NorthbounderException(errorMsg); LOG.error(errorMsg, e); throw e; } LOG.info("Forwarding {} alarms to engine {}", alarms.size(), m_engine.getName()); alarms.forEach(this::process); }
ebldr = new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI, Alarmd.NAME); ebldr.addParam(EventConstants.PARM_DAEMON_NAME, Alarmd.NAME); ebldr.addParam(EventConstants.PARM_REASON, ex.getMessage()); } finally { if (ebldr != null)
ebldr = new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI, Alarmd.NAME); ebldr.addParam(EventConstants.PARM_DAEMON_NAME, Alarmd.NAME); ebldr.addParam(EventConstants.PARM_REASON, ex.getMessage()); } finally { if (ebldr != null)
/** * Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue * calls this method to send alarms to the northern NMS. * * @param alarms the alarms * @throws NorthbounderException the northbounder exception */ @Override public void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException { if (alarms == null) { String errorMsg = "No alarms in alarms list for BSF forwarding."; NorthbounderException e = new NorthbounderException(errorMsg); LOG.error(errorMsg, e); throw e; } LOG.info("Forwarding {} alarms to engine {}", alarms.size(), m_engine.getName()); alarms.forEach(this::process); }
@Override public void reloadConfig() throws NorthbounderException { LOG.info("Reloading JMS northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the JMS northbound configuration", e); } }
/** * Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue * calls this method to send alarms to the northern NMS. * * @param alarms the alarms * @throws NorthbounderException the northbounder exception */ @Override public void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException { if (alarms == null) { String errorMsg = "No alarms in alarms list for SNMP Trap forwarding."; NorthbounderException e = new NorthbounderException(errorMsg); LOG.error(errorMsg, e); throw e; } LOG.info("Forwarding {} alarms to destination {}", alarms.size(), m_trapSink.getName()); for (NorthboundAlarm alarm : alarms) { try { SnmpTrapConfig config = m_trapSink.createTrapConfig(alarm); if (config != null) { m_trapHelper.forwardTrap(config); } } catch (SnmpTrapException e) { LOG.error("Can't send trap for {}", alarm, e); } } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { // FIXME As this can be expensive, I would say do it on a per-engine basis LOG.info("Reloading BSF northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the BSF trap northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { // FIXME As this can be expensive, I would say do it on a per-engine basis LOG.info("Reloading Drools northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the Drools northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { LOG.info("Reloading SNMP Traps northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the SNMP trap northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { // FIXME As this can be expensive, I would say do it on a per-engine basis LOG.info("Reloading BSF northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the BSF trap northbound configuration", e); } }
/** * Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue * calls this method to send alarms to the northern NMS. * * @param alarms the alarms * @throws NorthbounderException the northbounder exception */ @Override public void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException { if (alarms == null) { String errorMsg = "No alarms in alarms list for syslog forwarding."; NorthbounderException e = new NorthbounderException(errorMsg); LOG.error(errorMsg, e); throw e; } LOG.info("Forwarding {} alarms to destination {}", alarms.size(), m_destination.getName()); for (NorthboundAlarm alarm : alarms) { try { JavaSendMailer mailer = new JavaSendMailer(getSendmailConfig(alarm), false); mailer.send(); } catch (JavaMailerException e) { LOG.error("Can't send email for {}", alarm, e); } } }
/** * Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue * calls this method to send alarms to the northern NMS. * * @param alarms the alarms * @throws NorthbounderException the northbounder exception */ @Override public void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException { if (alarms == null) { String errorMsg = "No alarms in alarms list for syslog forwarding."; NorthbounderException e = new NorthbounderException(errorMsg); LOG.error(errorMsg, e); throw e; } LOG.info("Forwarding {} alarms to destination {}", alarms.size(), m_destination.getName()); for (NorthboundAlarm alarm : alarms) { try { JavaSendMailer mailer = new JavaSendMailer(getSendmailConfig(alarm), false); mailer.send(); } catch (JavaMailerException e) { LOG.error("Can't send email for {}", alarm, e); } } }
/** * Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue * calls this method to send alarms to the northern NMS. * * @param alarms the alarms * @throws NorthbounderException the northbounder exception */ @Override public void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException { if (alarms == null) { String errorMsg = "No alarms in alarms list for drools forwarding."; NorthbounderException e = new NorthbounderException(errorMsg); LOG.error(errorMsg, e); throw e; } LOG.info("Forwarding {} alarms to engine {}", alarms.size(), m_engine.getName()); alarms.forEach(a -> { LOG.debug("Begin correlation for alarm {} uei: {}", a.getId(), a.getUei()); m_kieSession.insert(a); LOG.debug("End correlation for alarm {} uei: {}", a.getId(), a.getUei()); }); }
/** * Reloads the configuration. */ @Override public void reloadConfig() { LOG.info("Reloading Email northbound configuration."); try { m_configDao.reload(); m_javaMailDao.reloadConfiguration(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the SNMP trap northbound configuration", e); } }
@Override protected void onStop() { if (m_engine.getOnStop() != null) { LOG.debug("running stop script for BSF engine {}", getName()); try { m_manager.exec(m_engine.getLanguage(), "", 0, 0, m_engine.getOnStop()); } catch (BSFException e) { throw new NorthbounderException("Cannot execute stop script", e); } } }
@Override protected void onStop() { if (m_engine.getOnStop() != null) { LOG.debug("running stop script for BSF engine {}", getName()); try { m_manager.exec(m_engine.getLanguage(), "", 0, 0, m_engine.getOnStop()); } catch (BSFException e) { throw new NorthbounderException("Cannot execute stop script", e); } } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { LOG.info("Reloading Syslog northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); // Unregistering Syslog destinations Syslog.shutdown(); // Shutdown all Syslog instances. registerNorthnounders(); // Re-registering all Syslog destinations. } catch (Exception e) { throw new NorthbounderException("Can't reload the Syslog northbound configuration", e); } } }
/** * Reloads the configuration. */ @Override public void reloadConfig() { LOG.info("Reloading Email northbound configuration."); try { m_configDao.reload(); m_javaMailDao.reloadConfiguration(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the SNMP trap northbound configuration", e); } }
clientWrapper.useRelaxedSSL("https"); } catch (final GeneralSecurityException e) { throw new NorthbounderException("Failed to configure HTTP northbounder for relaxed SSL.", e); if (!range.contains(code)) { LOG.debug("response code out of range for uri:{}. Expected {} but received {}", uri, range, code); throw new NorthbounderException("response code out of range for uri:" + uri + ". Expected " + range + " but received " + code); throw new NorthbounderException(e); } catch (final IOException e) { throw new NorthbounderException(e); } finally { IOUtils.closeQuietly(clientWrapper);
/** * Gets the URI. * * @return the URI */ public URI getURI() { try { return new URI(getScheme(), getUserInfo(), getHost(), getPort(), getPath(), getQuery(), getFragment()); } catch (URISyntaxException e) { throw new NorthbounderException(e); } }