org.iitb.untwine
Class SnmpWalk

java.lang.Object
  |
  +--org.iitb.untwine.SnmpWalk
All Implemented Interfaces:
java.io.Serializable, org.opennms.protocols.snmp.SnmpHandler

public class SnmpWalk
extends java.lang.Object
implements org.opennms.protocols.snmp.SnmpHandler, java.io.Serializable

This class is designed to do a walk on an SNMP tree of an individual agent on a remote host.

This class uses the JoeSNMP libraries from OpenNMS.

See Also:
Serialized Form

Constructor Summary
SnmpWalk()
           
 
Method Summary
 java.util.Vector snmpGet(java.lang.String host, java.lang.String commName, java.lang.String oid)
          Returns the value of specified oid as parameter
 void snmpInternalError(org.opennms.protocols.snmp.SnmpSession session, int err, org.opennms.protocols.snmp.SnmpSyntax pdu)
          Defined by the SnmpHandler interface.
 void snmpReceivedPdu(org.opennms.protocols.snmp.SnmpSession session, int cmd, org.opennms.protocols.snmp.SnmpPduPacket pdu)
          This method is defined by the SnmpHandler interface and invoked when the agent responds to the management application.
 void snmpTimeoutError(org.opennms.protocols.snmp.SnmpSession session, org.opennms.protocols.snmp.SnmpSyntax pdu)
          This method is define by the SnmpHandler interface and invoked if an agent fails to respond.
 java.util.Vector walk(java.lang.String host, java.lang.String commName, java.lang.String oid)
          It will walk the entire agent tree, or a subsection as defined by the parameters specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpWalk

public SnmpWalk()
Method Detail

snmpInternalError

public void snmpInternalError(org.opennms.protocols.snmp.SnmpSession session,
                              int err,
                              org.opennms.protocols.snmp.SnmpSyntax pdu)
Defined by the SnmpHandler interface. Used to process internal session errors.
Specified by:
snmpInternalError in interface org.opennms.protocols.snmp.SnmpHandler
Parameters:
session - The SNMP session in error.
err - The Error condition
pdu - The pdu associated with this error condition

snmpTimeoutError

public void snmpTimeoutError(org.opennms.protocols.snmp.SnmpSession session,
                             org.opennms.protocols.snmp.SnmpSyntax pdu)
This method is define by the SnmpHandler interface and invoked if an agent fails to respond.
Specified by:
snmpTimeoutError in interface org.opennms.protocols.snmp.SnmpHandler
Parameters:
session - The SNMP session in error.
pdu - The PDU that timed out.

snmpReceivedPdu

public void snmpReceivedPdu(org.opennms.protocols.snmp.SnmpSession session,
                            int cmd,
                            org.opennms.protocols.snmp.SnmpPduPacket pdu)
This method is defined by the SnmpHandler interface and invoked when the agent responds to the management application.
Specified by:
snmpReceivedPdu in interface org.opennms.protocols.snmp.SnmpHandler
Parameters:
session - The session receiving the pdu.
cmd - The command from the pdu.
pdu - The received pdu.
See Also:
SnmpPduPacket.getCommand()

walk

public java.util.Vector walk(java.lang.String host,
                             java.lang.String commName,
                             java.lang.String oid)
It will walk the entire agent tree, or a subsection as defined by the parameters specified.
Parameters:
host - Remote host IP Address which is to be queried through SNMP.
commName - Community name String.
oid - Object id from which the tree is to be traversed.
Returns:
Vector of the result of Walk, containing objects of class SnmpVarBind.

snmpGet

public java.util.Vector snmpGet(java.lang.String host,
                                java.lang.String commName,
                                java.lang.String oid)
Returns the value of specified oid as parameter
Parameters:
host - Remote host IP Address which is to be queried through SNMP.
commName - Community name String.
oid - Object id from which the value is to be obtained
Returns:
Vector of the result of Get, containing object of class SnmpVarBind.