Package org.snmp4j.tools.console
Class SnmpRequest
java.lang.Object
org.snmp4j.tools.console.SnmpRequest
- All Implemented Interfaces:
EventListener
,CommandResponder
,PDUFactory
The SnmpRequest application is an example implementation of most of the
SNMP4J features. It can be used to send SNMP requests to a target or to
listen for traps/notifications and inform requests.
- Version:
- 1.9
- Author:
- Frank Fock
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
protected int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreatePDU
(MessageProcessingModel messageProcessingModel) Creates aPDU
instance that is compatible with the given SNMP version (message processing model).Creates aPDU
instance for the supplied target.int
int
int
int
int
int
int
Vector<? extends VariableBinding>
getVbs()
int
boolean
void
listen()
static void
protected static void
printReport
(PDU response) protected static void
printUsageprotected static void
printVariableBindings
(PDU response) protected static void
void
Process an incoming request, report or notification PDU.send()
void
setAddress
(Address address) void
setAuthoritativeEngineID
(OctetString authoritativeEngineID) void
setAuthPassphrase
(OctetString authPassphrase) void
setAuthProtocol
(OID authProtocol) void
setCommunity
(OctetString community) void
setContextEngineID
(OctetString contextEngineID) void
setContextName
(OctetString contextName) void
setLowerBoundIndex
(OID lowerBoundIndex) void
setMaxRepetitions
(int maxRepetitions) void
setNonRepeaters
(int nonRepeaters) void
setNumDispatcherThreads
(int numDispatcherThreads) void
setOperation
(int operation) void
setPduType
(int pduType) void
setPrivPassphrase
(OctetString privPassphrase) void
setPrivProtocol
(OID privProtocol) void
setRetries
(int retries) void
setSecurityName
(OctetString securityName) void
setSysUpTime
(TimeTicks sysUpTime) void
void
setTimeout
(int timeout) void
setTrapOID
(OID trapOID) void
setUpperBoundIndex
(OID upperBoundIndex) void
setUseDenseTableOperation
(boolean useDenseTableOperation) void
setVbs
(Vector<VariableBinding> vbs) void
setVersion
(int version) void
table()
-
Field Details
-
DEFAULT
public static final int DEFAULT- See Also:
-
WALK
public static final int WALK- See Also:
-
LISTEN
public static final int LISTEN- See Also:
-
TABLE
public static final int TABLE- See Also:
-
CVS_TABLE
public static final int CVS_TABLE- See Also:
-
TIME_BASED_CVS_TABLE
public static final int TIME_BASED_CVS_TABLE- See Also:
-
SNAPSHOT_CREATION
public static final int SNAPSHOT_CREATION- See Also:
-
SNAPSHOT_DUMP
public static final int SNAPSHOT_DUMP- See Also:
-
operation
protected int operation
-
-
Constructor Details
-
SnmpRequest
-
-
Method Details
-
getPduType
public int getPduType() -
getVersion
public int getVersion() -
getVbs
-
isUseDenseTableOperation
public boolean isUseDenseTableOperation() -
getUpperBoundIndex
-
getTrapOID
-
getTimeout
public int getTimeout() -
getTarget
-
getSysUpTime
-
getSecurityName
-
getRetries
public int getRetries() -
getPrivProtocol
-
getPrivPassphrase
-
getOperation
public int getOperation() -
getNumDispatcherThreads
public int getNumDispatcherThreads() -
getNonRepeaters
public int getNonRepeaters() -
getMaxRepetitions
public int getMaxRepetitions() -
getLowerBoundIndex
-
getContextName
-
getContextEngineID
-
getCommunity
-
getAuthoritativeEngineID
-
getAuthProtocol
-
getAuthPassphrase
-
getAddress
-
listen
- Throws:
IOException
-
send
- Throws:
IOException
-
printVersion
protected static void printVersion() -
printUsage
protected static void printUsage()printUsage -
printVariableBindings
-
printReport
-
processPdu
Description copied from interface:CommandResponder
Process an incoming request, report or notification PDU.- Specified by:
processPdu
in interfaceCommandResponder
- Parameters:
e
- aCommandResponderEvent
instance containing the PDU to process and some additional information returned by the message processing model that decoded the SNMP message.
-
createPDU
Description copied from interface:PDUFactory
Creates aPDU
instance for the supplied target. The created PDU has to be compliant to the SNMP version defined by the supplied target. For example, a SNMPv3 target requires a ScopedPDU instance.- Specified by:
createPDU
in interfacePDUFactory
- Parameters:
target
- theTarget
where the PDU to be created will be sent.- Returns:
- PDU a PDU instance that is compatible with the supplied target.
-
createPDU
Description copied from interface:PDUFactory
Creates aPDU
instance that is compatible with the given SNMP version (message processing model).- Specified by:
createPDU
in interfacePDUFactory
- Parameters:
messageProcessingModel
- aMessageProcessingModel
instance.- Returns:
- a
PDU
instance that is compatible with the given SNMP version (message processing model).
-
table
- Throws:
IOException
-
main
-
setAddress
-
setVersion
public void setVersion(int version) -
setVbs
-
setUseDenseTableOperation
public void setUseDenseTableOperation(boolean useDenseTableOperation) -
setUpperBoundIndex
-
setTrapOID
-
setTimeout
public void setTimeout(int timeout) -
setTarget
-
setSysUpTime
-
setSecurityName
-
setRetries
public void setRetries(int retries) -
setPrivProtocol
-
setPrivPassphrase
-
setPduType
public void setPduType(int pduType) -
setOperation
public void setOperation(int operation) -
setNumDispatcherThreads
public void setNumDispatcherThreads(int numDispatcherThreads) -
setNonRepeaters
public void setNonRepeaters(int nonRepeaters) -
setMaxRepetitions
public void setMaxRepetitions(int maxRepetitions) -
setLowerBoundIndex
-
setContextName
-
setContextEngineID
-
setCommunity
-
setAuthoritativeEngineID
-
setAuthProtocol
-
setAuthPassphrase
-