com.ireasoning.protocol.snmp
Class SnmpSession
java.lang.Object
com.ireasoning.protocol.ListenerManager
com.ireasoning.protocol.Session
com.ireasoning.protocol.snmp.SnmpBaseSession
com.ireasoning.protocol.snmp.SnmpSession
- All Implemented Interfaces:
- Serializable, State
- public class SnmpSession
- extends com.ireasoning.protocol.snmp.SnmpBaseSession
This class implements a session for sending/receiving snmp message.
By default, UDP is the underlying transport layer. But TCP transport layer is
also supported.
The snmp requests are retried if time out. The default retry times is 3, but is
configurable by using setRetries(int retries) method.
Note:
Synchronous and asynchronous methods cannot be used together in one SnmpSession object.
For example, for a SnmpSession object session, if you already use session.asyncSnmpGetRequest(...),
another call to session.snmpGetRequest(...)
may not work correctly.
- See Also:
SnmpPdu,
snmpget.java example,
Serialized Form
| Fields inherited from class com.ireasoning.protocol.Session |
_localAddr, _localPort, _state, _target, _thread, _timeout, _transportLayer, _tries, DEFAULT_TIME_OUT, TCP, UDP |
|
Constructor Summary |
SnmpSession(SnmpTarget target)
Creates a SnmpSession using the default UDP protocol. |
SnmpSession(SnmpTarget target,
int transportLayer)
Constructs a new SnmpSession. |
SnmpSession(SnmpTarget target,
int transportLayer,
InetAddress localAddr,
int localPort)
Constructs a new SnmpSession. |
SnmpSession(String hostname,
int port,
String readCommunity,
String writeCommunity,
int version)
Creates a SnmpSession |
SnmpSession(String hostname,
int port,
String readCommunity,
String writeCommunity,
int version,
int transportLayer)
Creates a SnmpSession |
|
Method Summary |
void |
addEngine(byte[] engineID)
Adds a new SnmpEngine |
void |
addEngine(SnmpEngine engine)
Adds a new SnmpEngine |
void |
asyncSend(SnmpPdu pdu)
Used for asynchronous communication. |
SnmpPdu |
asyncSnmpGetBulkRequest(SnmpOID[] oids,
int nonRepeaters,
int maxRepetitions)
Issues SNMP GET_BULK command asynchronously |
SnmpPdu |
asyncSnmpGetBulkRequest(String[] oids,
int nonRepeaters,
int maxRepetitions)
Issues SNMP GET_BULK command asynchronously |
SnmpPdu |
asyncSnmpGetNextRequest(SnmpOID oid)
Issues SNMP GET_NEXT command asynchronously |
SnmpPdu |
asyncSnmpGetNextRequest(SnmpOID[] oids)
Issues SNMP GET_NEXT command asynchronously |
SnmpPdu |
asyncSnmpGetNextRequest(String oid)
Issues SNMP GET_NEXT command asynchronously |
SnmpPdu |
asyncSnmpGetNextRequest(String[] oids)
Issues SNMP GET_NEXT command asynchronously |
SnmpPdu |
asyncSnmpGetRequest(SnmpOID oid)
Issues SNMP GET command asynchronously |
SnmpPdu |
asyncSnmpGetRequest(SnmpOID[] oids)
Issues SNMP GET command asynchronously |
SnmpPdu |
asyncSnmpGetRequest(String oid)
Issues SNMP GET command asynchronously |
SnmpPdu |
asyncSnmpGetRequest(String[] oids)
Issues SNMP GET command asynchronously |
ArrayList |
broadcastDiscovery(SnmpOID oid)
Sends out an SNMP broadcast message without retries. |
void |
close()
close the session |
String |
getMibVersion()
Returns the mib version associated with this session |
TransportData |
getPduData(SnmpPdu pdu)
Gets the PDU data in byte array format |
SnmpEngine |
getSnmpV3Engine()
Returns the discovered SNMPv3 engine object. |
UsmUser |
getSnmpV3User()
Returns the SNMPv3 USM user object. |
Target |
getTarget()
Returns the SnmpTarget object
that represents properties of remote agent. |
int |
getTimeoutForAsyncRequests()
|
Properties |
getV3Params()
Returns SNMPv3 parameters in a Properties. |
int |
getVersion()
Returns the SNMP version number supported in this session |
static void |
loadMib(String mibFileName)
Loads mib file, so MIB node name can also be used besides numeric OID. |
static void |
loadMib(String mibFileName,
boolean isStrict)
Loads mib file, so MIB node name can also be used besides numeric OID. |
static void |
loadMib(String mibFileName,
boolean isStrict,
String mibVersion)
Loads mib file, so MIB node name can also be used besides numeric OID. |
static void |
loadMib(String mibFileName,
String mibVersion)
Loads mib file, so MIB node name can also be used besides numeric OID. |
static void |
loadMib2()
Loads MIB-II (RFC1213) from the built-in resource file. |
static void |
loadMibs(String[] fileNames,
boolean isStrict,
String mibVersion)
Loads multiple MIB files. |
static void |
loadMibs(String[] fileNames,
String mibVersion)
Loads multiple MIB files. |
SnmpEngine |
lookupEngine(byte[] engineID)
Looks up SnmpEngine instance based on engineID |
SnmpEngine |
lookupEngine(String host,
int port)
Looks up SnmpEngine instance based on host name and port |
SnmpEngine |
lookupEngine(Target target)
Looks up SnmpEngine instance based on host name and port |
protected UsmUser |
lookupUsmUser(String userName,
byte[] engineID,
InetAddress address)
Looks up USM user based on passed user name and engineID. |
static MibTreeNode |
parseMib(String fileName)
Returns the MIB tree representation in a MibTreeNode object, which is the root of the MIB tree. |
static MibTreeNode |
parseMib(String fileName,
boolean isStrict)
Returns the MIB tree representation in a MibTreeNode object, which is the root of the MIB tree. |
static MibTreeNode[] |
parseMibsWithoutMerge(String[] fileNames)
Parses passed MIB files strictly. |
static MibTreeNode[] |
parseMibsWithoutMerge(String[] fileNames,
boolean isStrict)
Parses passed MIB files. |
protected Object |
receiveObject()
Callback method, it gets called when a new packet is received |
SnmpEngine |
removeEngine(byte[] engineID)
Removes SnmpEngine from engine table |
SnmpEngine |
removeEngine(SnmpEngine engine)
Removes SnmpEngine from engine table |
SnmpEngine |
removeEngine(String host,
int port)
Removes SnmpEngine from engine table |
SnmpEngine |
removeEngine(Target target)
Removes SnmpEngine from engine table |
void |
removeUsmUser(String userName,
byte[] engineID)
Removes a UserUser instance from internal map. |
SnmpPdu |
send(SnmpPdu pdu)
Sends out SnmpPdu, it blocks until response comes back. |
protected void |
sendPdu(SnmpPdu pdu,
boolean addToReqMap)
Sends out PDU |
void |
setMibVersion(String mibVersion)
Associates this SNMP session with the passed mibVersion. |
void |
setTarget(SnmpTarget target)
Sets a new target |
void |
setTarget(Target target)
Sets a new target |
void |
setTimeout(int timeout)
Sets time out value of underlying Socket of synchronous requests. |
void |
setTimeoutForAsyncRequests(int timeout)
Set timeout value for asynchronous requests. |
static void |
setToUseJCE(boolean b)
Choose to use SUN JCE for SNMPv3 encryption |
void |
setV3Params(String userName,
String authProtocol,
byte[] authKey,
byte[] privKey,
String contextName,
byte[] contextEngineID)
Sets SNMPV3 USM user information if you know localized authentication and privacy keys. |
void |
setV3Params(String userName,
String authProtocol,
String authPassword,
int privProtocol,
String privPassword)
Sets SNMPV3 USM user information, assuming empty contextName ("") and
contextEngineID ( zero length byte array, that is, 'new byte[0]') . |
void |
setV3Params(String userName,
String authProtocol,
String authPassword,
int privProtocol,
String privPassword,
String contextName,
byte[] contextEngineID)
Sets SNMPV3 USM user information. |
void |
setV3Params(String userName,
String authProtocol,
String authPassword,
String privPassword)
Sets SNMPV3 USM user information, assuming empty contextName ("") and
contextEngineID ( zero length byte array, that is, 'new byte[0]') . |
void |
setV3Params(String userName,
String authProtocol,
String authPassword,
String privPassword,
String contextName,
byte[] contextEngineID)
Sets SNMPV3 USM user information. |
void |
setVersion(int version)
Sets the SNMP version number supported in this session |
void |
snmpBulkGetSubtree(SnmpOID startingOID,
Listener listener)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data asynchronously. |
void |
snmpBulkGetSubtree(SnmpOID startingOID,
Listener listener,
int maxRepetitions)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data asynchronously. |
void |
snmpBulkGetSubtree(String startingOID,
Listener listener)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data asynchronously. |
void |
snmpBulkWalk(SnmpOID startingOID,
Listener listener)
Uses SNMPV2 GET_BULK requests to query a network entity efficiently for a tree of information asynchronously. |
void |
snmpBulkWalk(String startingOID,
Listener listener)
Uses SNMPV2 GET_BULK requests to query a network entity efficiently for a tree of information asynchronously. |
SnmpPdu |
snmpGetBulkRequest(SnmpOID[] oids,
int nonRepeaters,
int maxRepetitions)
Issues SNMP GET_BULK command, it blocks until response comes back |
SnmpPdu |
snmpGetBulkRequest(String[] oids,
int nonRepeaters,
int maxRepetitions)
Issues SNMP GET_BULK command, it blocks until response comes back |
SnmpPdu |
snmpGetNextRequest(SnmpOID oid)
Issues SNMP GET command, it blocks until response comes back |
SnmpPdu |
snmpGetNextRequest(SnmpOID[] oids)
Issues SNMP GET command, it blocks until response comes back |
SnmpPdu |
snmpGetNextRequest(String oid)
Issues SNMP GET command, it blocks until response comes back |
SnmpPdu |
snmpGetNextRequest(String[] oids)
Issues SNMP GET command, it blocks until response comes back |
SnmpPdu |
snmpGetRequest(SnmpOID oid)
Issues SNMP GET command, it blocks until response comes back |
SnmpPdu |
snmpGetRequest(SnmpOID[] oids)
Issues SNMP GET command, it blocks until response comes back |
void |
snmpGetRequest(SnmpOID start,
SnmpOID end,
Listener listener)
Synchronous request to retrieve all instances between passed start
and end |
SnmpPdu |
snmpGetRequest(String oid)
Issues SNMP GET command, it blocks until response comes back |
SnmpPdu |
snmpGetRequest(String[] oids)
Issues SNMP GET command, it blocks until response comes back |
SnmpVarBind[] |
snmpGetSubtree(SnmpOID startingOID)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data. |
void |
snmpGetSubtree(SnmpOID startingOID,
Listener listener)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data asynchronously. |
SnmpVarBind[] |
snmpGetSubtree(SnmpOID startingOID,
SnmpError error)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data. |
SnmpVarBind[] |
snmpGetSubtree(String startingOID)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data. |
void |
snmpGetSubtree(String startingOID,
Listener listener)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data asynchronously. |
SnmpVarBind[] |
snmpGetSubtree(String startingOID,
SnmpError error)
The GetSubtree operation allows a management application to retrieve "subtrees" of MIB data. |
SnmpTableModel |
snmpGetTable(String tableName)
Gets whole MIB table and returns a SnmpTableModel object which contains retrieved data |
SnmpTableModel |
snmpGetTable(String tableName,
int maxVarBindCount)
Gets whole MIB table and returns a SnmpTableModel object which contains retrieved data |
boolean |
snmpGetTable(String tableName,
SnmpTableModel model)
Gets whole MIB table and returns a SnmpTableModel object which contains retrieved data |
boolean |
snmpGetTable(String tableName,
SnmpTableModel model,
int maxVarBindCount)
Gets whole MIB table and returns a SnmpTableModel object which contains retrieved data |
SnmpVarBind[] |
snmpGetTableColumn(SnmpOID columnOID)
Returns the values of passed table column. |
SnmpVarBind[] |
snmpGetTableColumn(String columnName)
Returns the values of passed table column. |
SnmpPdu |
snmpInformRequest(long sysUpTime,
SnmpOID snmpTrapOID,
SnmpVarBind[] vbs)
Sends SNMPv2c/v3 INFORM request to the remote trap receiver.
Note:
The default port for sending inform requests (162) is not the same used
for the GET, GET_NEXT, SET etc... |
SnmpPdu |
snmpSetRequest(SnmpPdu pdu)
Issues SNMP SET command, it blocks until response comes back |
void |
snmpWalk(SnmpOID startingOID,
Listener listener)
This method does SNMP walk, starting from the startingOID, walk through
the MIBs until end of mib view is reached. |
void |
snmpWalk(String startingOID,
Listener listener)
This method does SNMP walk, starting from the startingOID, walk through
the MIBs until end of mib view is reached. |
static void |
unloadMib(String fileName)
Unloads MIB file |
void |
write(SnmpPdu pdu)
Similar to send(SnmpPdu) method, but it returns immediately and no wait for the response. |
| Methods inherited from class com.ireasoning.protocol.Session |
finalize, getRetries, getState, getStateString, getTimeout, getTransportLayer, open, open, open, reopen, setRetries, setTransportLayer, startThread |
SnmpSession
public SnmpSession(String hostname,
int port,
String readCommunity,
String writeCommunity,
int version)
throws IOException
- Creates a SnmpSession
- Parameters:
hostname - host name or ip address of snmp agentport - port number of snmp agentreadCommunity - community name for snmp read operations, such as GET, GET_NEXT, GET_BULK, INFORM. It does not matter if this is a SNMPv3 sessionwriteCommunity - community name for snmp write operation (SNMP SET). It does not matter if this is a SNMPv3 sessionversion - the snmp version supported by agent, one of { SnmpConst.SNMPV1, SnmpConst.SNMPV2, SnmpConst.SNMPV3 }, whose values are {0, 1, 3}
- Throws:
IOException - raised if can't connect to agent
IllegalArgumentException - raised if any of passed arguments is invalid
SnmpSession
public SnmpSession(String hostname,
int port,
String readCommunity,
String writeCommunity,
int version,
int transportLayer)
throws IOException
- Creates a SnmpSession
- Parameters:
hostname - host name or ip address of snmp agentport - port number of snmp agentreadCommunity - community name for snmp read operations, such as GET, GET_NEXT, GET_BULK, INFORM. It does not matter if this is a SNMPv3 sessionwriteCommunity - community name for snmp write operation (SNMP SET). It does not matter if this is a SNMPv3 sessionversion - the snmp version supported by agent, one of { SnmpConst.SNMPV1, SnmpConst.SNMPV2, SnmpConst.SNMPV3 }, whose values are {0, 1, 3}transportLayer - the transport layer to use. UDP is the
default. Possible values are {Session.TCP, Session.UDP}
- Throws:
IOException - raised if can't connect to agent
IllegalArgumentException - raised if any of passed arguments is invalid
SnmpSession
public SnmpSession(SnmpTarget target,
int transportLayer)
throws IOException
- Constructs a new SnmpSession.
- Parameters:
target - an instance contains agent's properties, such as host name,
port number, community name, snmp version number.transportLayer - the transport layer to use. UDP is the
default. Possible values are {Session.TCP, Session.UDP}
- Throws:
IOException - raised if can't connect to agent
SnmpSession
public SnmpSession(SnmpTarget target,
int transportLayer,
InetAddress localAddr,
int localPort)
throws IOException
- Constructs a new SnmpSession.
- Parameters:
target - an instance contains agent's properties, such as host name,
port number, community name, snmp version number.transportLayer - the transport layer to use. UDP is the
default. Possible values are {Session.TCP, Session.UDP}localAddr - the local address the socket is bound to. If the IP address is 0.0.0.0, the socket will be bound to the wildcard address, an IP address chosen by the kernel.localPort - the local port the socket is bound to. The local port must be between 0 and 65535 inclusive.
- Throws:
IOException - raised if can't connect to agent
SnmpSession
public SnmpSession(SnmpTarget target)
throws IOException
- Creates a SnmpSession using the default UDP protocol.
- Parameters:
target - a object contains agent's properties, such as host name,
port number, community name.
- Throws:
IOException - raised if can't connect to agent
setMibVersion
public void setMibVersion(String mibVersion)
- Associates this SNMP session with the passed
mibVersion. It's only necessary
when you need to load multiple versions of one MIB.
- Parameters:
mibVersion - If you have multiple versions of a MIB module, this parameter is
used to distinguish different versions. It doesn't have to be the same as the actual
version number, but it has to be unique among all the MIBs with the same module name.
getMibVersion
public String getMibVersion()
- Returns the mib version associated with this session
loadMib
public static void loadMib(String mibFileName,
String mibVersion)
throws IOException,
ParseException
- Loads mib file, so MIB node name can also be used besides numeric OID. It's equivalent to calling
MibUtil.loadMib method. This method is the same as loadMib(mibFileName, true)
Note: It's a static method, so a MIB only needs to be loaded once in a JVM.
- Parameters:
mibFileName - mib file name. If this file is already loaded, nothing happensmibVersion - If you have multiple versions of a MIB module, this parameter is
used to distinguish different versions. It doesn't have to be the same as the actual
version number, but it has to be unique among all the MIBs with the same module name.
Use null if only no multiple versions of a mib.
- Throws:
IOException - raised if mib file not found
ParseException - raised if mib file is corrupted- See Also:
MibUtil.loadMib(java.lang.String),
setMibVersion(java.lang.String),
loadMib2()
loadMib
public static void loadMib(String mibFileName)
throws IOException,
ParseException
- Loads mib file, so MIB node name can also be used besides numeric OID. It's equivalent to calling
MibUtil.loadMib method. This method is the same as loadMib(mibFileName, true)
Note: It's a static method, so a MIB only needs to be loaded once in a JVM.
- Parameters:
mibFileName - mib file name. If this file is already loaded, nothing happens
- Throws:
IOException - raised if mib file not found
ParseException - raised if mib file is corrupted- See Also:
MibUtil.loadMib(java.lang.String),
setMibVersion(java.lang.String),
loadMib2()
loadMib
public static void loadMib(String mibFileName,
boolean isStrict,
String mibVersion)
throws IOException,
ParseException
- Loads mib file, so MIB node name can also be used besides numeric OID. It's equivalent to calling
MibUtil.loadMib method.
Note: It's a static method, so a MIB only needs to be loaded once in a JVM.
- Parameters:
mibFileName - mib file name. If this file is already loaded, nothing happensisStrict - if true, MIB is parsed strictly, any error in MIB will raise exception. Otherwise only an error message is written to log filemibVersion - If you have multiple versions of a MIB module, this parameter is
used to distinguish different versions. It doesn't have to be the same as the actual
version number, but it has to be unique among all the MIBs with the same module name.
Use null if only no multiple versions of a mib.
- Throws:
IOException - raised if mib file not found
ParseException - raised if mib file is corrupted- See Also:
MibUtil.loadMib(java.lang.String),
setMibVersion(java.lang.String),
loadMib2()
loadMib
public static void loadMib(String mibFileName,
boolean isStrict)
throws IOException,
ParseException
- Loads mib file, so MIB node name can also be used besides numeric OID. It's equivalent to calling
MibUtil.loadMib method.
Note: It's a static method, so a MIB only needs to be loaded once in a JVM.
- Parameters:
mibFileName - mib file name. If this file is already loaded, nothing happensisStrict - if true, MIB is parsed strictly, any error in MIB will raise exception. Otherwise only an error message is written to log file
- Throws:
IOException - raised if mib file not found
ParseException - raised if mib file is corrupted- See Also:
MibUtil.loadMib(java.lang.String),
loadMib2()
loadMib2
public static void loadMib2()
- Loads MIB-II (RFC1213) from the built-in resource file. It's equivalent to calling
MibUtil.loadMib2 method.
Note: It's a static method, so a MIB only needs to be loaded once in a JVM.
- See Also:
MibUtil.loadMib2(),
loadMib(java.lang.String, java.lang.String)
loadMibs
public static void loadMibs(String[] fileNames,
String mibVersion)
throws IOException,
MibParseException
- Loads multiple MIB files.
- Parameters:
fileNames - MIB file namesmibVersion - If you have multiple versions of a MIB module, this parameter is
used to distinguish different versions. It doesn't have to be the same as the actual
version number, but it has to be unique among all the MIBs with the same module name.
Use null if only no multiple versions of a mib.
- Throws:
IOException
MibParseException- See Also:
loadMib(java.lang.String, java.lang.String)
loadMibs
public static void loadMibs(String[] fileNames,
boolean isStrict,
String mibVersion)
throws IOException,
MibParseException
- Loads multiple MIB files.
- Parameters:
fileNames - MIB file namesisStrict - if true, MIB is parsed strictly, any error in MIB will raise exception. Otherwise only an error message is written to log filemibVersion - If you have multiple versions of a MIB module, this parameter is
used to distinguish different versions. It doesn't have to be the same as the actual
version number, but it has to be unique among all the MIBs with the same module name.
Use null if only no multiple versions of a mib.
- Throws:
IOException
MibParseException- See Also:
loadMib(java.lang.String, java.lang.String)
unloadMib
public static void unloadMib(String fileName)
- Unloads MIB file
- Parameters:
fileName - mib file to unload. If this file was not loaded, nothing happens
parseMib
public static MibTreeNode parseMib(String fileName)
throws IOException,
MibParseException
- Returns the MIB tree representation in a MibTreeNode object, which is the root of the MIB tree.
The parser is capable of parsing both SMIv1 (SNMPv1) and SMIv2 (SNMPv2/v3) MIBs.
- Parameters:
fileName - file name of the MIB
- Returns:
- root node
- Throws:
IOException
MibParseException
parseMib
public static MibTreeNode parseMib(String fileName,
boolean isStrict)
throws IOException,
MibParseException
- Returns the MIB tree representation in a MibTreeNode object, which is the root of the MIB tree.
The parser is capable of parsing both SMIv1 (SNMPv1) and SMIv2 (SNMPv2/v3) MIBs.
- Parameters:
fileName - file name of the MIBisStrict - if true, MIB is parsed strictly, any error in MIB will raise exception. Otherwise only an error message is written to log file
- Returns:
- root node
- Throws:
IOException
MibParseException
parseMibsWithoutMerge
public static MibTreeNode[] parseMibsWithoutMerge(String[] fileNames)
throws IOException,
MibParseException
- Parses passed MIB files strictly.
and returns tree representation for each of the MIBs. No merge of trees is performed.
- Parameters:
fileNames - file names of the MIBs
- Returns:
- MibTreeNode array corresponding to the passed
fileNames
- Throws:
IOException
MibParseException
parseMibsWithoutMerge
public static MibTreeNode[] parseMibsWithoutMerge(String[] fileNames,
boolean isStrict)
throws IOException,
MibParseException
- Parses passed MIB files.
and returns tree representation for each of the MIBs. No merge of trees is performed.
- Parameters:
fileNames - file names of the MIBsisStrict - if true, MIB is parsed strictly, any error in MIB will raise exception. Otherwise only an error message is written to log file
- Returns:
- MibTreeNode array corresponding to the passed
fileNames
- Throws:
IOException
MibParseException
sendPdu
protected void sendPdu(SnmpPdu pdu,
boolean addToReqMap)
throws IOException
- Sends out PDU
- Parameters:
pdu - pdu to be sentaddToReqMap - true to add this pdu to the request ID map, which is used to
correlate request and respons. It should be true in asynchronous mode, false in
synchronous mode.
- Throws:
IOException - raised if can't send data to remote host
getPduData
public TransportData getPduData(SnmpPdu pdu)
throws SnmpEncodingException
- Gets the PDU data in byte array format
- Parameters:
pdu - PDU object to be converted to byte array
- Returns:
- PDU data in byte array format
- Throws:
SnmpEncodingException - raised if PDU's data is corrupted
asyncSend
public void asyncSend(SnmpPdu pdu)
throws IOException
- Used for asynchronous communication. Caller needs call
addListener(Listener) first to register a listener object, then call this
method to send out PDU, a separate thread (only one thread) will notify listener later
about received PDU. It doesn't block after calling this method.
- Parameters:
pdu - a pdu to be sent out.
- Throws:
IOException - if socket is not valid.- See Also:
send(SnmpPdu),
snmpasyncget.java example
asyncSnmpGetRequest
public SnmpPdu asyncSnmpGetRequest(String oid)
throws IOException
- Issues SNMP GET command asynchronously
- Parameters:
oid - the SNMP OID to be sent to the agent. If it's a MIB node name (such as "sysUpTime", "ifAdminStatus.2"),
it'll be converted to SnmpOID first if corresponding MIB file has been loaded by calling loadMib method.
- Returns:
- the request PDU object
- Throws:
IllegalArgumentException - if passed MIB node name (such as "sysUpTime") cannot be resolved
IOException - if socket is not valid.- See Also:
- snmpasyncget.java example,
asyncSend(SnmpPdu),
asyncSnmpGetRequest(SnmpOID),
asyncSnmpGetRequest(String[])
asyncSnmpGetRequest
public SnmpPdu asyncSnmpGetRequest(SnmpOID oid)
throws IOException
- Issues SNMP GET command asynchronously
- Parameters:
oid - the SNMP OID to be sent to the agent
- Returns:
- the request PDU object
- Throws:
IOException - if socket is not valid.- See Also:
- snmpasyncget.java example,
asyncSend(SnmpPdu),
asyncSnmpGetRequest(String),
asyncSnmpGetRequest(SnmpOID[]),
asyncSnmpGetRequest(String)
asyncSnmpGetRequest
public SnmpPdu asyncSnmpGetRequest(String[] oids)
throws IOException
- Issues SNMP GET command asynchronously
- Parameters:
oids - the SNMP OIDs to be sent to the agent. If it's a MIB node name (such as "sysUpTime", "ifAdminStatus.2"), it'll be converted to SnmpOID first if corresponding MIB file has been loaded by calling loadMib method.
- Returns:
- the request PDU object
- Throws:
IOException - if socket is not valid.
IllegalArgumentException - if passed MIB node name (such as "sysUpTime") cannot be resolved- See Also:
- snmpasyncget.java example
asyncSnmpGetRequest
public SnmpPdu asyncSnmpGetRequest(SnmpOID[] oids)
throws IOException
- Issues SNMP GET command asynchronously
- Parameters:
oids - the SNMP OIDs to be sent to the agent in one request
- Returns:
- the request PDU object
- Throws:
IOException - if socket is not valid.- See Also:
asyncSnmpGetRequest(SnmpOID),
asyncSnmpGetRequest(String[]),
snmpasyncget.java example
asyncSnmpGetNextRequest
public SnmpPdu asyncSnmpGetNextRequest(String oid)
throws IOException
- Issues SNMP GET_NEXT command asynchronously
- Parameters:
oid - the SNMP OID to be sent to the agent. If it's a MIB node name (such as "sysUpTime", "ifAdminStatus.2"), it'll be converted to SnmpOID first if corresponding MIB file has been loaded by calling loadMib method.
- Returns:
- the request PDU object
- Throws:
IOException - if socket is not valid.
IllegalArgumentException - if passed MIB node name (such as "sysUpTime") cannot be resolved- See Also:
asyncSnmpGetNextRequest(SnmpOID),
asyncSnmpGetNextRequest(String[])
asyncSnmpGetNextRequest
public SnmpPdu asyncSnmpGetNextRequest(SnmpOID oid)
throws IOException
- Issues SNMP GET_NEXT command asynchronously
- Parameters:
oid - the SNMP OID to be sent to the agent
- Returns:
- the request PDU object
- Throws:
IOException - if socket is not valid.- See Also:
asyncSnmpGetNextRequest(SnmpOID[]),
asyncSnmpGetNextRequest(String)
asyncSnmpGetNextRequest
public SnmpPdu asyncSnmpGetNextRequest(String[] oids)
throws IOException
- Issues SNMP GET_NEXT command asynchronously
- Parameters:
oids - the SNMP OIDs to be sent to the agent. If it's a MIB node name (such as "sysUpTime", "ifAdminStatus.2"), it'll be converted to SnmpOID first if corresponding MIB file has been loaded by calling loadMib method.
- Returns:
- the request PDU object
- Throws:
IOException - if socket is not valid.
IllegalArgumentException - if passed MIB node name (such as "sysUpTime") cannot be resolved
asyncSnmpGetNextRequest
public SnmpPdu asyncSnmpGetNextRequest(SnmpOID[] oids)
throws IOException
- Issues SNMP GET_NEXT command asynchronously
- Parameters:
oids - the SNMP OIDs to be sent to the agent in one request
- Returns:
- the request PDU object
- Throws:
IOException - if socket is not valid.- See Also:
asyncSnmpGetNextRequest(SnmpOID),
asyncSnmpGetNextRequest(String[])
asyncSnmpGetBulkRequest
public SnmpPdu asyncSnmpGetBulkRequest(String[] oids,
int nonRepeaters,
int maxRepetitions)
throws IOException
- Issues SNMP GET_BULK command asynchronously
- Parameters:
oids - the SNMP OIDs to be sent to the agent. If it's a MIB node name (such as "sysUpTime", "ifAdminStatus.2"), it'll be converted to SnmpOID first if corresponding MIB file has been loaded by calling loadMib method.nonRepeaters - - Number of variable bindings to get one time.maxRepetitions - - Number of repetitions for the variable bindings to get multiple times.
- Returns:
- the request PDU object
- Throws:
IllegalArgumentException - if passed MIB node name (such as "sysUpTime") cannot be resolved
IOException - if socket is not valid.