Package com.ibm.di.connector
Class SNMPConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- com.ibm.di.connector.SNMPConnector
-
- All Implemented Interfaces:
ConnectorInterface,VersionInfoInterface,com.tivoli.snmp.TrapFilter,com.tivoli.snmp.TrapListener,java.io.Serializable
public class SNMPConnector extends Connector implements com.tivoli.snmp.TrapListener, com.tivoli.snmp.TrapFilter
The SNMPConnector implements get/set/walk and trap-receive operations by means of the IBM Tivoli SNMP Stack.The connector can operate in two modes: Client and Trap Receiver - Client Mode
In client mode you can use it in iterator mode where the connector will send a getnext request to the snmp agent and return one entry for each OID returned by the agent. In Lookup mode the connector will perform a get request returning the oid/value for the requested oid. The link criteria specifies: oid and optionally server, port and version.
- Trap Receiver Mode
In trap receiver mode the connector can only be used in Iterator mode. The connector will listen for incoming snmp traps and return each as an entry to the caller. Both V1, V2c and V3 traps are handled.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
-
-
Constructor Summary
Constructors Constructor Description SNMPConnector()" Constructor for the SNMPConnector object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanfilter(com.tivoli.snmp.SnmpTrap trap)Indicates that trap should be sent to this connector.EntryfindEntry(SearchCriteria search)Searches for an entry matching the specified search criteria.EntrygetNextEntry()Gets the nextEntry attribute of the SNMPConnector objectjava.lang.StringgetVersion()Version information.voidhandle(com.tivoli.snmp.SnmpTrap trap)Trap listenervoidinitialize(java.lang.Object o)This methods initializes the SNMP API library, reads the Connector configurations parameters, subscribes for SNMP Traps and opens an SNMP session.voidputEntry(Entry entry)Send SNMP data.voidreconnect()Reconnect to the underlying data source.EntryreturnEntry(java.lang.Object obj)Checks the type of the given object.voidselectEntries()This method initializes the SNMP PDU (protocol data unit) to be sent on all subsequent getNextEntry calls as part of the get next request.voidsendTrap(Entry entry)Send a SNMP trap using the given Entryvoidterminate()This method unsubscribes from SNMP Trap events, terminates the SNMP API library, i.e.-
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, extractExceptionInformation, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, modEntry, modEntry, pushback, queryOperations, queryReply, querySchema, queryTables, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, terminateServer
-
-
-
-
Method Detail
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersionin interfaceVersionInfoInterface- Returns:
- version information
-
getNextEntry
public Entry getNextEntry() throws java.lang.Exception
Gets the nextEntry attribute of the SNMPConnector object- Specified by:
getNextEntryin interfaceConnectorInterface- Overrides:
getNextEntryin classConnector- Returns:
- The nextEntry value
- Throws:
java.lang.Exception- An exception is thrown if this method fails.- See Also:
ConnectorInterface.selectEntries()
-
returnEntry
public Entry returnEntry(java.lang.Object obj) throws java.lang.Exception
Checks the type of the given object. If it is an Entry, it casts it to an Entry and returns it.- Parameters:
obj- String, Entry or Exception.- Returns:
- returns null if a String is passed. Otherwise if an Entry is passed returns the Object cast to Entry.
- Throws:
java.lang.Exception- If the object is an Exception or is not an instance of the above classes, an Exception is thrown.
-
initialize
public void initialize(java.lang.Object o) throws java.lang.ExceptionThis methods initializes the SNMP API library, reads the Connector configurations parameters, subscribes for SNMP Traps and opens an SNMP session.- Specified by:
initializein interfaceConnectorInterface- Overrides:
initializein classConnector- Parameters:
o- An object the AssemblyLine passes to the Connector on init- Throws:
java.lang.Exception- An exception is thrown if this method fails.
-
terminate
public void terminate()
This method unsubscribes from SNMP Trap events, terminates the SNMP API library, i.e. this method cleans up.- Specified by:
terminatein interfaceConnectorInterface- Overrides:
terminatein classConnector
-
selectEntries
public void selectEntries() throws java.lang.ExceptionThis method initializes the SNMP PDU (protocol data unit) to be sent on all subsequent getNextEntry calls as part of the get next request.- Specified by:
selectEntriesin interfaceConnectorInterface- Overrides:
selectEntriesin classConnector- Throws:
java.lang.Exception- An exception is thrown if this method fails.
-
findEntry
public Entry findEntry(SearchCriteria search) throws java.lang.Exception
Searches for an entry matching the specified search criteria.- Specified by:
findEntryin interfaceConnectorInterface- Overrides:
findEntryin classConnector- Parameters:
search- the search criteria- Returns:
- the entry found
- Throws:
java.lang.Exception- An exception is thrown if this method fails.
-
putEntry
public void putEntry(Entry entry) throws java.lang.Exception
Send SNMP data.- Specified by:
putEntryin interfaceConnectorInterface- Overrides:
putEntryin classConnector- Parameters:
entry- an entry containing the SNMP data to send- Throws:
java.lang.Exception- An exception is thrown if this method fails.
-
sendTrap
public void sendTrap(Entry entry) throws java.io.IOException
Send a SNMP trap using the given Entry- Parameters:
entry-- Throws:
java.io.IOException
-
filter
public boolean filter(com.tivoli.snmp.SnmpTrap trap)
Indicates that trap should be sent to this connector.- Specified by:
filterin interfacecom.tivoli.snmp.TrapFilter- Parameters:
trap- theSnmpTrapobject.- Returns:
- true
-
handle
public void handle(com.tivoli.snmp.SnmpTrap trap)
Trap listener- Specified by:
handlein interfacecom.tivoli.snmp.TrapListener- Parameters:
trap- The SNMP trap to be handled
-
reconnect
public void reconnect() throws java.lang.ExceptionReconnect to the underlying data source.- Overrides:
reconnectin classConnector- Throws:
java.lang.Exception- if an error occurs.- See Also:
Connector.initialize(Object)
-
-