|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.adventnet.snmp.snmp2.agent.Cache
|
+--com.adventnet.snmp.snmp2.agent.BaseSnmpStore
|
+--com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
|
+--com.adventnet.snmp.snmp2.agent.SnmpTrapService
Used to send SNMPV1 traps & SNMPV2c\V3 Notifcations
Use setSeperateTrapSession(false) to have a same Session which shares with the SnmpAgent for sending traps. By default uses separate session for sending Traps. The default implementation requires the SnmpAgent (or the source bean for SnmpPduRequestEvent) to be alive
Provides a low level API to send traps
Listener component for TrapRequestEvents doesn't provide MIB support ie API users would need to explicitly fill the Trap details which needs to be sent.
Based on the Event parameters a TrapForwardingTable is used for sending Traps
To use in applications:
or
If the agent acts as a standalone agent then the trap is send through SnmpSession for the registered managers in the table maintained by this SnmpTrapService.
| Field Summary | |
(package private) XMLToVector |
fileToVector
|
(package private) ForwardingTable |
forTable
|
(package private) SimpleTrapForwardingTable |
hdlr
|
(package private) boolean |
isPersistence
|
(package private) boolean |
isReliableTraps
|
(package private) NotificationLogTableRequestHandler |
notifHdlr1
|
(package private) NotificationVarbindTableRequestHandler |
notifVarHdlr1
|
(package private) int |
numRowsforRelTraps
|
(package private) boolean |
selectedPort
|
(package private) static NativeSnmpTrap |
snmpTrap
|
(package private) java.lang.String |
trapPathName
|
(package private) SnmpPDU |
trapPDU
|
(package private) static boolean |
trapSet
|
(package private) java.lang.String |
trapTableName
|
(package private) V3ForwardingTable |
v3ForTable
|
(package private) java.lang.String |
v3TrapTableName
|
| Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService |
agentAddr,
community,
enterprise,
forTable,
hdlr,
isInformRequest,
listener,
managerHost,
managerPort,
rowIndex,
selectedPort,
sessionPort,
snmpLog,
tfTable,
trapIndex,
trapPDU,
trapSource,
trapSourceDefault,
varb,
version |
| Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore |
debugLevel,
localAddress,
oldAddress,
oldPort,
protocol,
session,
snmpLog |
| Fields inherited from class com.adventnet.snmp.snmp2.agent.Cache |
cache,
debug |
| Constructor Summary | |
SnmpTrapService()
no arg constructor which uses the separate SnmpSession. |
|
SnmpTrapService(boolean isPersistence)
Deprecated. - persistence options can be set from the ForwardingTable classes. Secondary constructor which uses the separate SnmpSession and turns ON/OFF Persistence storage of TrapForwardingTable. API users can have a separate session by calling setSeperateTrapSession(false) |
|
SnmpTrapService(int port)
The port Constructor so that the Traps will be sent throgh the Session opened at the specified Port. |
|
SnmpTrapService(java.lang.String ipAddress,
int port)
The ipAddress, port Constructor so that the Traps will be sent through the Session opened at the specified Port and Address. |
|
SnmpTrapService(java.lang.String dirStr,
java.lang.String fileName,
boolean fToVPersistence)
Deprecated. - persistence options can be set from the ForwardingTable classes. Secondary constructor which uses the separate SnmpSession and specifies the persistence of TFTable parameters and type of persistence(FToV or XML Format). API users can have a separate session by calling setSeperateTrapSession(false) |
|
| Method Summary | |
protected void |
addSnmpV2TrapHeader(SnmpPDU pdu,
SnmpSession session,
SnmpOID enterprise,
int trapIndex,
long timeticks)
Adds Trap Header in Snmp Version 2 model |
void |
addTrapRequest(TrapRequestEvent te)
This is the listener method for TrapRequestEvents. |
protected void |
doRegistration()
Does the Registration of the TrapForwarding Table to the PduRequestHandler Tree. |
java.lang.String |
getContextName()
Get the contextName for the V3 message to be forwarded with the notification. |
byte |
getSecurityLevel()
Getter for securityLevel of the SnmpV3 Trap to be sent when DEFAULT option is chosen |
int |
getSecurityModel()
Get the securityModel for the V3 message to be forwarded with the notification. |
static boolean |
getTrapFlag()
Deprecated. - as this method is no longer needed. This trapFlag is especially useful in sending trap if the agent registered as sub-agent with Windows master agent. If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag. |
static NativeSnmpTrap |
getTrapObject()
Deprecated. - as this method is no longer needed. gets the NativeSnmpTrap object If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this trapflag is set .The Aeadll.dll polls for this trapflag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this trapflag. |
java.lang.String |
getTrapPathName()
Deprecated. - persistence has been moved to Table files. Getter for the trapPathName . By Default the SnmpTrapService will take the managers from this trapTable path specified. |
java.lang.String |
getTrapTableName()
Deprecated. use the method in ForwardingTable. Getter for the trapTableName . By Default the SnmpTrapService will take the managers from this trapTable fileName specified. |
java.lang.String |
getUserName()
Get the userName to be used while forwarding the SnmpV3 notification message. |
java.lang.String |
getV3TrapTableName()
Deprecated. Make use of the V3ForwardingTable methods. Getter for the v3TrapTableName . By Default the SnmpTrapService will take the managers from this v3TrapTable fileName specified. |
boolean |
isPersistence()
Deprecated. - persistence has been moved to Table files. Getter for Flag isPersistence which specifies the Persistency of the values of Trap Forwarding Table. By Default the Persistence to the fileSystem is turned ON. |
boolean |
isReliableTraps()
Method to know whether this Traps were stored - reliable. |
void |
nativeInitTrapService()
This method initialises the trap session and and puts the session in the cache. |
protected void |
printDecodedPDU(SnmpPDU pdu)
|
void |
sendTrap(java.lang.Object entry,
SnmpOID enterprise,
java.lang.String community,
int trapIndex,
long timeticks,
java.util.Vector varbindVector)
send the Trap to the managers in the TrapForwarding Table |
protected void |
sendTrap(SnmpPDU pdu,
java.lang.String managerNode,
int managerPort,
java.lang.String community)
Used to send SNMPV1 Traps & SNMPV2\V3 Notifications This is low_level method which API users can use to send trap. |
void |
sendTrap(java.lang.String managerNode,
int managerPort,
SnmpOID enterprise,
java.lang.String community,
int trapIndex,
long timeticks,
java.util.Vector varbindVector,
int version)
Used to send SNMPV1 & SNMPV2 traps This is low_level method which API users can use to send trap. |
protected void |
sendTrapToManagersInTable(SnmpOID enterprise,
java.lang.String community,
int trapIndex,
long timeticks,
java.util.Vector varbindings,
int version)
send the Trap to the managers in the TrapForwarding Table |
void |
setContextName(java.lang.String contextName)
Set the contextName for the V3 message to be forwarded with the notification. |
void |
setFToVPersistence(boolean fToVPersistence)
Deprecated. - persistence has been moved to ForwardingTable files. |
void |
setHandler(SimpleTrapForwardingTable handler)
Method to set the SimpleTrapForwardingTable Handler for this TrapService. |
void |
setPersistence(boolean value)
Deprecated. use the method in ForwardingTable and V3TrapForwardingTable. Sets whether or not persistence storage to be used or not. By default this will be true |
void |
setRefreshTrapTable(int refreshTime)
Used to update the TrapTable periodically |
void |
setReliableTraps(boolean isReliableTraps,
int numRows)
The Method added for the Reliable Traps Support. |
void |
setSecurityLevel(byte securityLevel)
Setter for securityLevel of the SnmpV3 Trap to be sent when DEFAULT option is chosen |
void |
setSecurityModel(int securityModel)
Set the securityModel for the V3 message to be forwarded with the notification. |
static void |
setTrapFlag(boolean flag)
Deprecated. - as this method is no longer needed. Sets the Trap Flag. This trapFlag is especially useful in sending trap if the agent registered as sub-agent with Windows master agent. If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag. |
void |
setTrapForwardingTable(TrapForwardingTableInterface intf)
Sets the TrapForwardingTable which is used by this TrapRequestListener By default the SnmpTrapService maintains a TrapTable which takes the default managers from a text file under the directory "conf". |
static void |
setTrapObject(NativeSnmpTrap trap)
Deprecated. - as this method is no longer needed. sets the NativeSnmpTrap which holds the trap information when the trap is to be send through the windows master agent. |
void |
setTrapPathName(java.lang.String pathName)
Deprecated. - persistence has been moved to Table files. Setter for the trapPathName . By Default the SnmpTrapService will take the managers from this trapTable path specified. |
void |
setTrapTableName(java.lang.String tableName)
Deprecated. Make use of the ForwardingTable methods. Setter for the trapTableName . By Default the SnmpTrapService will take the managers from this trapTable fileName specified. |
void |
setUserName(java.lang.String userName)
Set the userName to be used while forwarding the SnmpV3 notification message. |
void |
setV3TrapTableName(java.lang.String tableName)
Deprecated. Make use of the V3ForwardingTable methods. Setter for the v3TrapTableName . By Default the SnmpTrapService will take the managers from this v3TrapTable fileName specified. |
void |
setWriter(XMLToVector writer)
Method to set the XMLToVector instance for storing the datas. |
| Methods inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore |
closeAll,
finalize,
getSnmpAPI,
getSnmpSession,
getSnmpSession,
initSession,
initSnmpStore,
isAlive,
isDebug,
killSnmpAgent |
| Methods inherited from class com.adventnet.snmp.snmp2.agent.Cache |
getFromCache,
getMibOperations,
putInCache,
setMibOperations |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
boolean selectedPort
SnmpPDU trapPDU
boolean isReliableTraps
V3ForwardingTable v3ForTable
ForwardingTable forTable
java.lang.String trapPathName
java.lang.String trapTableName
java.lang.String v3TrapTableName
SimpleTrapForwardingTable hdlr
boolean isPersistence
XMLToVector fileToVector
static boolean trapSet
static NativeSnmpTrap snmpTrap
int numRowsforRelTraps
NotificationLogTableRequestHandler notifHdlr1
NotificationVarbindTableRequestHandler notifVarHdlr1
| Constructor Detail |
public SnmpTrapService()
public SnmpTrapService(int port)
port - the int value of the port from where the Traps are to be
sent.
public SnmpTrapService(java.lang.String ipAddress,
int port)
port - the int value of the port from where the Traps are to be sent.ipAddress - String denoting the ipAddress to which the TrapSession
has to be bound.public SnmpTrapService(boolean isPersistence)
isPersistence - to turn ON persistence or Not
public SnmpTrapService(java.lang.String dirStr,
java.lang.String fileName,
boolean fToVPersistence)
isPersistence - to turn ON persistence or Not| Method Detail |
public void setTrapForwardingTable(TrapForwardingTableInterface intf)
For example to make a manager entry remotely,
API users can have their own trapForwardingTable and call this method.
intf - the TrapForwardingTableInterfacepublic void setRefreshTrapTable(int refreshTime)
refreshTime - Time period for refreshing the TrapTable.public void addTrapRequest(TrapRequestEvent te)
te - the trap eventTrapRequestEvent
public void sendTrap(java.lang.String managerNode,
int managerPort,
SnmpOID enterprise,
java.lang.String community,
int trapIndex,
long timeticks,
java.util.Vector varbindVector,
int version)
managerNode - The Manager HostmanagerPort - The Manager Port to send the Trapenterprise - Enterprise Oidcommunity - The community with which the Trap is to be senttrapIndex - The TrapIndex of the Traptimeticks - The Agent upTimevarbind - Vector of SnmpVarBind variablesversion - SnmpTrap version to be sent.SnmpAPI,
SnmpVarBindprotected void sendTrap(SnmpPDU pdu, java.lang.String managerNode, int managerPort, java.lang.String community)
pdu - The enterprise SNMP PDUmanagerNode - The Manager HostmanagerPort - The Manager Port to which the Trap is to be sentcommunity - The community with which the Trap is to be sentSnmpPDUprotected void printDecodedPDU(SnmpPDU pdu)
protected void addSnmpV2TrapHeader(SnmpPDU pdu, SnmpSession session, SnmpOID enterprise, int trapIndex, long timeticks)
public void setSecurityModel(int securityModel)
int - securityModel - the securityModelpublic void setContextName(java.lang.String contextName)
String - contextName - the contextName.public void setUserName(java.lang.String userName)
String - userName - the userName .public int getSecurityModel()
public java.lang.String getContextName()
public java.lang.String getUserName()
protected void sendTrapToManagersInTable(SnmpOID enterprise, java.lang.String community, int trapIndex, long timeticks, java.util.Vector varbindings, int version)
enterprise - The enterprise OIDcommunity - The community with which the Trap is to be senttrapIndex - The Trap Index of the Trap to be senttimeticks - The Agent UpTimevarbindings - The varBind Vectorversion - The Snmp Version of the Trappublic java.lang.String getTrapPathName()
public void setTrapPathName(java.lang.String pathName)
pathName - specifies the TrapPathName like this
"public java.lang.String getTrapTableName()
setTrapTableName(String tableName)public void setTrapTableName(java.lang.String tableName)
getTrapTableName()public java.lang.String getV3TrapTableName()
setV3TrapTableName(String tableName)public void setV3TrapTableName(java.lang.String tableName)
getV3TrapTableName()public boolean isReliableTraps()
public void setPersistence(boolean value)
val - true for persistence and false for non persistenceisPersistence()public boolean isPersistence()
setPersistence(boolean value)protected void doRegistration()
public static boolean getTrapFlag()
If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag.
setTrapFlag(boolean flag)public static void setTrapFlag(boolean flag)
This trapFlag is especially useful in sending trap if the agent registered as sub-agent with Windows master agent.
If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag.
flag - specifying the boolean value of registration of the Agent as a subAgent to Windows MasterAgentgetTrapFlag()public static void setTrapObject(NativeSnmpTrap trap)
trap - The NativeSnmpTrap objectgetTrapObject()public static NativeSnmpTrap getTrapObject()
If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this trapflag is set .The Aeadll.dll polls for this trapflag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this trapflag.
setTrapObject,
NativeSnmpTrappublic void nativeInitTrapService()
public void setFToVPersistence(boolean fToVPersistence)
public byte getSecurityLevel()
public void setSecurityLevel(byte securityLevel)
securityLevel - The securityLevel of the Trap PDU to be sent
public void setReliableTraps(boolean isReliableTraps,
int numRows)
isReliableTraps - true to set the feature on.numRows - the int value of the mnumber of rows needed in the
reliable trap table.NotificationLogTable,
NotifcationVarBindTablepublic void setWriter(XMLToVector writer)
writer - the XMLToVector instance.public void setHandler(SimpleTrapForwardingTable handler)
handler - The SimpleTrapForwardingTable instance.
public void sendTrap(java.lang.Object entry,
SnmpOID enterprise,
java.lang.String community,
int trapIndex,
long timeticks,
java.util.Vector varbindVector)
entry - the Forwarding\V3Forwarding Entry Object for which the
Trap is to be sent.enterprise - The enterprise OIDcommunity - The community with which the Trap is to be senttrapIndex - The Trap Index of the Trap to be senttimeticks - The Agent UpTimevarbindings - The varBind Vectorversion - The Snmp Version of the Trap
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||