Package com.tailf.ncs.snmp.snmp4j
package com.tailf.ncs.snmp.snmp4j
NCS snmp4j support package
This package contains classes provided to support the use of snmp4j in NCS.
For the moment this support consists of a SNMP notification receiver that uses snmp4j to listen for notifications.
The benefit of using these classes is that the configuration of snmp4j is contained in the NCS configuration. The user provides handlers (or callbacks) that processes the notifications e.g. maps these to NCS alarms that are delivered to the NCS Alarm API *
Example: The expected usage of the NotificationReceiver and the, by the user, provided NotificationHandlers are in the main() method of the service manager:
public class App { .... public static void main(String[] args) { .... // setting up AlarmManager and Snmp Notification receiver try { // We set up the AlarmSinkCentral to enable asynch // alarm provision to NCS. Socket cdbSocket = new Socket("localhost", Conf.NCS_PORT); Cdb cdb = new Cdb("snmp-notif-alarm-sink", cdbSocket); AlarmSinkCentral sinkCentral = AlarmSinkCentral.getAlarmSink(100000, cdb); // start sinkCental if not already running if (!sinkCentral.isAlive()) { sinkCentral.start(); } // Register snmp NotificationHandlers // and start the NotificationReceiver ExampleHandler handl = new ExampleHandler(); NotificationReceiver notifRec = NotificationReceiver.getNotificationReceiver() // register example handler notifRec.register(handl, null); // example of an anonymous handler notifRec.register(new NotificationHandler() { public HandlerResponse processPdu(CommandResponderEvent event, Object opaque) throws Exception { System.out.println("\n\n" + "------>Anonymous Filter called" + "\n\n"); return HandlerResponse.CONTINUE; } }, null); // start the NotificationReceiver notifRec.start(); } catch (Exception e) { e.printStackTrace(); } .... } .... }
-
ClassDescriptionInternal snmp4j callback class used by the SnmpNotificationReceiverThis interface describes the context for the notification eventEventContext implementation classStandard filter for sending Acknowledge response to Snmp INFORMs This filter is implemented as a handler in the same way as user defined handlers and the only difference is that it is always registered in the beginning of the handler chain.Standard filter for suppression of notifications emanating from ip addresses outside defined set of addresses The filter determines the source ip address first from the snmpTrapAddress 1.3.6.1.6.3.18.1.3 varbind if this is set, or otherwise from the emanating peer ip address.Standard filter for suppression of received snmp events which are not TRAP, NOTIFICATION or INFORM This filter is implemented as a handler in the same way as user defined handlers and the only difference is that it is always registered in the beginning of the handler chain.Response enums controlling the execution of the handler chainHelper class which holds handler and if applicable the corresponding opaque object for a registered handlerInterface that all Handlers must implement to be able to register for the NotificationReceiverThis class mediated the use of Snmp4j for receiving and mapping of incoming snmp notifications.