/** * Start the embedded agent */ private void startAgent() throws Exception { initRequestHandler(); initResponder(); initMessageDispatcher(); initTransportMapping(); initSession(); addUsmUsers(); session.listen(); }
/** * Complete emitter initialisation **/ public void start() throws Exception { // Load persisted manager subscriptions load(); // Instantiate the trap factory this.trapFactory = (TrapFactory) Class.forName(this.snmpAgentService.getTrapFactoryClassName(), true, this.getClass().getClassLoader()).newInstance(); // Initialise this.trapFactory.set(this.snmpAgentService.getClock(), this.snmpAgentService.getTrapCounter(), this.snmpAgentService.getRequestHandler()); // Start the trap factory this.trapFactory.start(); }
@Override public long getNextJMXNotificationSequenceNumber() { return getNextNotificationSequenceNumber(); }
startAgent(); this.heartbeat = new Heartbeat(this.getServer(), this.getTimerName(), this.getHeartBeatPeriod()); this.sendNotification(new Notification(EventTypes.COLDSTART, this, getNextNotificationSequenceNumber()));
void sendTrap(PDU trap, Target target, String securityName) throws IOException { this.snmpAgentService.getTrapCounter().advance(); if(snmpAgentService.getUserMap().get(securityName) == null) { throw new IllegalArgumentException("Notification Security Name " +securityName + " doesn't match any user defined in users.xml"); } else { ((UserTarget)target).setSecurityLevel(snmpAgentService.getUserMap().get(securityName).getSecurityLevel()); ((UserTarget)target).setSecurityModel(SecurityModel.SECURITY_MODEL_USM); User user = snmpAgentService.getUserMap().get(securityName); UsmUser usmUser = new UsmUser(userSecurityName, user.getAuthenticationProtocolID(), snmpAgentService.getSession().send(trap, target);
wrapper.set(snmpAgentService.getClock(), snmpAgentService.getTrapCounter());
log.debug("Reading resource: '" + this.snmpAgentService.getManagersResName() + "'"); final String resName = this.snmpAgentService.getManagersResName(); is = SecurityActions.getThreadContextClassLoaderResource(resName); log.error("Accessing resource '" + snmpAgentService.getManagersResName() + "'"); throw e; log.debug("Reading resource: '" + snmpAgentService.getNotificationMapResName() + "'"); final String resName = snmpAgentService.getNotificationMapResName(); is = SecurityActions.getThreadContextClassLoaderResource(resName); log.error("Accessing resource '" + snmpAgentService.getNotificationMapResName() + "'"); throw e; } finally {
private void initRequestHandler()throws Exception{ this.requestHandler = (RequestHandler)Class.forName(this.requestHandlerClassName,true,this.getClass().getClassLoader()).newInstance(); this.requestHandler.initialize(this.requestHandlerResName, this.getServer(), this.log, this.clock); }
/** * Reconfigures the RequestHandler, reponsible for handling get requests etc. * * @jmx:managed-operation */ public void reconfigureRequestHandler() throws Exception { if (requestHandler instanceof Reconfigurable) ((Reconfigurable)requestHandler).reconfigure(getRequestHandlerResName()); else throw new UnsupportedOperationException("Request handler is not Reconfigurable"); }
startAgent(); this.heartbeat = new Heartbeat(this.getServer(), this.getTimerName(), this.getHeartBeatPeriod()); this.sendNotification(new Notification(EventTypes.COLDSTART, this, getNextNotificationSequenceNumber()));
void sendTrap(PDU trap, Target target, String securityName) throws IOException { this.snmpAgentService.getTrapCounter().advance(); if(snmpAgentService.getUserMap().get(securityName) == null) { throw new IllegalArgumentException("Notification Security Name " +securityName + " doesn't match any user defined in users.xml"); } else { ((UserTarget)target).setSecurityLevel(snmpAgentService.getUserMap().get(securityName).getSecurityLevel()); ((UserTarget)target).setSecurityModel(SecurityModel.SECURITY_MODEL_USM); User user = snmpAgentService.getUserMap().get(securityName); UsmUser usmUser = new UsmUser(userSecurityName, user.getAuthenticationProtocolID(), snmpAgentService.getSession().send(trap, target);
wrapper.set(snmpAgentService.getClock(), snmpAgentService.getTrapCounter());
log.debug("Reading resource: '" + this.snmpAgentService.getManagersResName() + "'"); final String resName = this.snmpAgentService.getManagersResName(); is = SecurityActions.getThreadContextClassLoaderResource(resName); log.error("Accessing resource '" + snmpAgentService.getManagersResName() + "'"); throw e; log.debug("Reading resource: '" + snmpAgentService.getNotificationMapResName() + "'"); final String resName = snmpAgentService.getNotificationMapResName(); is = SecurityActions.getThreadContextClassLoaderResource(resName); log.error("Accessing resource '" + snmpAgentService.getNotificationMapResName() + "'"); throw e; } finally {
private void initRequestHandler()throws Exception{ this.requestHandler = (RequestHandler)Class.forName(this.requestHandlerClassName,true,this.getClass().getClassLoader()).newInstance(); this.requestHandler.initialize(this.requestHandlerResName, this.getServer(), this.log, this.clock); }
/** * Reconfigures the RequestHandler, reponsible for handling get requests etc. * * @jmx:managed-operation */ public void reconfigureRequestHandler() throws Exception { if (requestHandler instanceof Reconfigurable) ((Reconfigurable)requestHandler).reconfigure(getRequestHandlerResName()); else throw new UnsupportedOperationException("Request handler is not Reconfigurable"); }
/** * Start the embedded agent */ private void startAgent() throws Exception { initRequestHandler(); initResponder(); initMessageDispatcher(); initTransportMapping(); initSession(); addUsmUsers(); session.listen(); }
/** * Complete emitter initialisation **/ public void start() throws Exception { // Load persisted manager subscriptions load(); // Instantiate the trap factory this.trapFactory = (TrapFactory) Class.forName(this.snmpAgentService.getTrapFactoryClassName(), true, this.getClass().getClassLoader()).newInstance(); // Initialise this.trapFactory.set(this.snmpAgentService.getClock(), this.snmpAgentService.getTrapCounter(), this.snmpAgentService.getRequestHandler()); // Start the trap factory this.trapFactory.start(); }
@Override public long getNextJMXNotificationSequenceNumber() { return getNextNotificationSequenceNumber(); }
@Override public void sendJMXNotification(Notification notification) { if(notification.getSequenceNumber() <= 0) { notification.setSequenceNumber(getNextNotificationSequenceNumber()); } try { this.trapEmitter.send(notification); } catch (Exception e) { log.error("Problem occured while Sending trap", e); } }
@Override public void sendJMXNotification(Notification notification) { if(notification.getSequenceNumber() <= 0) { notification.setSequenceNumber(getNextNotificationSequenceNumber()); } try { this.trapEmitter.send(notification); } catch (Exception e) { log.error("Problem occured while Sending trap", e); } }