Class SNMPObj
Class SNMPObj
java.lang.Object
|
+----Information
|
+----SNMPObj
- public class SNMPObj
- extends Information
This class implements some custom functions on top of Information in
order to make easier the interaction with SNMP objects.
In the case a Java application wants to receive SNMP traps, it has to
create a TrapListener first (
CreateTrapListener method) . Then the Proxy stores the traps on behalf
of the applications which can fetch them using the WaitForTraps method. Make sure
that the TrapListener is deleted (
DeleteTrapListener method) prior to terminate the application. In
order to avoid having dangling listeners, TrapListeners not used for
more than 15 minutes are deleted automatically.
To know about how the SNMPObj works, please read the following paper: Network Management
for the 90s.
- See Also:
- Information, Proxy
-
-
SNMPObj()
-
-
SNMPObj(String remAgt, int remAgtPort)
-
SetSnmpAgentAddress(String remAgt, int remAgtPort)
- Sets SNMP's agent address.
-
SNMPWalk()
- Walk a SNMP MIB.
-
SNMPGetAttribute()
- Issue the SNMP Get request.
-
SNMPGetnextAttribute()
- Issue the SNMP GetNext request.
-
SNMPGetAttributeInfo(String syntax)
- Return information about an attribute syntax.
-
ConvertOID(String oid)
- Convert an OID from numeric to symbolic form and viceversa.
-
TrapsAvailable()
- Return the number of SNMP traps currently available.
-
CreateTrapListener(int port)
- Create a TrapListener.
-
DeleteTrapListener()
- Delete a TrapListener.
-
WaitForTraps(int timeout)
- Wait for traps up to a specified amount of time.
-
toString()
- Covert the instance to a String. Mostly used in order to print the instance.
SNMPObj
public SNMPObj()
- Create a SNMPObj instance. The SNMP agent address and port are set to 0.0.0.0:160.
SNMPObj
public SNMPObj(String remAgt, int remAgtPort)
- Create a SNMPObj instance.
- Parameters:
- remAgt - the TCP/IP of the remote SNMP agent.
- remAgtPort - the TCP/IP port of the remote host where the SNMP
agent is running (usually it is 160).
SetSnmpAgentAddress
public void SetSnmpAgentAddress(String remAgt, int remAgtPort)
- Set SNMP's agent address.
- Parameters:
- remAgt - the TCP/IP address of the host where the SNMP agent runs.
- remAgtPort - the port where the SNMP agent runs.
SNMPWalk
public Vector SNMPWalk() throws java.net.UnknownHostException, IOException, ProxyException
- Walk a SNMP MIB.
- Returns:
- A vector of Information instances contained in the MIB.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In case the Proxy instance reported some problems during the communication with Liaison or if a SNMP error has been generated in front of the request.
SNMPGetAttribute
public void SNMPGetAttribute() throws java.net.UnknownHostException, IOException, ProxyException
- Issue a SNMP Get. The response is stored inside the instance itself.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In case the Proxy instance reported some problems during the communication with Liaison or if a SNMP error has been generated in front of the request.
SNMPGetNextAttribute
public void SNMPGetNextAttribute() throws java.net.UnknownHostException, IOException, ProxyException
- Issue a SNMP GetNext. The response is stored inside the instance itself.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In case the Proxy instance reported some problems during the communication with Liaison or if a SNMP error has been generated in front of the request.
SNMPSetAttribute
public void SNMPSetAttribute() throws java.net.UnknownHostException, IOException, ProxyException
- Issue a SNMP Set. The response is stored inside the instance itself.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In case the Proxy instance reported some problems during the communication with Liaison or if a SNMP error has been generated in front of the request.
SNMPGetAttributeInfo
public String SNMPGetAttributeInfo(String syntax) throws java.net.UnknownHostException, IOException, ProxyException
- Return information about an attribute syntax.
- Parameters:
- syntax - An OID which corresponds to a known MIB variable.
- Returns:
- A string contained the requested information.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In case the Proxy instance reported some problems during the communication with Liaison or if a SNMP error has been generated in front of the request.
ConvertOID
public String ConvertOID(String oid) throws java.net.UnknownHostException, IOException, ProxyException
- Convert an OID from numeric to symbolic form and viceversa.
- Parameters:
- oid - the object identifier to convert.
- Returns:
- A string contained the requested oid.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In case the Proxy instance reported some problems during the communication with Liaison
TrapsAvailable
public int TrapsAvailable() throws java.net.UnknownHostException, IOException, ProxyException
- Return the number of SNMP traps currently available on the
TrapListener. Traps can be read using the WaitForTraps method.
- Returns:
- The number of SNMP traps currently available.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In case the Proxy instance reported some problems during the communication with Liaison.
CreateTrapListener
public void CreateTrapListener(int port) throws java.net.UnknownHostException, IOException, ProxyException
- Create a TrapListener in the Liaison side which is supposed to
receive incoming traps on behalf of the application.
- Parameters:
- port - the TCP/IP port (on the Liaison host) where the SNMP
traps are supposed to be received.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In
case the Proxy instance reported some problems during the
communication with Liaison or if the specified TCP/IP port is
already in use.
DeleteTrapListener
public void DeleteTrapListener() throws java.net.UnknownHostException, IOException, ProxyException
- Delete the TrapListener created using the CreateTrapListener method.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In
case the Proxy instance reported some problems during the
communication with Liaison or if the TrapListener has not yet been
created.
WaitForTraps
public Information WaitForTraps(int timeout) throws java.net.UnknownHostException, IOException, ProxyException
- Wait for a trap up to a specified period of time.
- Parameters:
- timeout - the timeout in seconds (-1 stands for infinite timeout).
- Returns:
- An Information object containing the trap or null in case of timeout.
- Throws:
- java.net.UnknownHostException - the host address specified when the instance has been created is unknown
- IOException - if an I/O error has occurred (e.g Liaison down or unreachable).
- ProxyException - In
case the Proxy instance reported some problems during the
communication with Liaison or if the TrapListener has not yet been
created.
toString
public synchronized String toString()
- Coverts the instance to a String.
Last modified: Thu Mar 6 13:53:01 MET 1997