|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Snmp
This interface describes the methods available in the "snmp" context of the MIB Explorer scripting programming interface. The Snmp context provides services to create SNMP request, load PDUs, modify their Variable Bindings, send SNMP requests and notifications synchronously and inspect SNMP responses. The context has several internal members which can be accessed through this interface:
Method Summary | |
---|---|
void |
createEmptyRequestPdu()
Sets the request PDU to an empty GET PDU with no variable bindings. |
PDU |
duplicate(PDU pdu)
Returns a duplicate of the given PDU for the current target. |
java.lang.String |
getCurrentTarget()
Returns the current target as a String. |
java.lang.String |
getDefaultTarget()
Returns the target (currently) configured for MIB Explorer. |
java.lang.Integer |
getErrorIndex()
Get the error index of the failed variable binding from the response PDU. |
java.lang.Integer |
getErrorStatus()
Get the error status of the response PDU. |
java.lang.String |
getErrorStatusText()
Get the response PDU's error status textual description. |
java.lang.String |
getPduDirectory()
Returns the directory where MIB Explorer has stored a PDU last. |
PDU |
getRequestPdu()
Returns the current request PDU. |
VariableBinding |
getRequestVariable(java.lang.String objectName)
Gets the variable binding of the current request PDU whose OID matches the OID given. |
PDU |
getResponsePdu()
Get the response PDU of the last request. |
java.lang.String |
getScriptName()
Gets the name of the script. |
java.lang.Integer |
getSnmpVersion()
Gets the SNMP version of the current target. |
java.util.List |
getTable(java.util.List columnOIDs,
java.lang.String lowerBoundIndex,
java.lang.String upperBoundIndex)
Gets synchronously SNMP tabular data from one or more tables. |
java.util.List |
getTable(java.util.List columnOIDs,
java.lang.String lowerBoundIndex,
java.lang.String upperBoundIndex,
int maxRepetitions)
Gets synchronously SNMP tabular data from one or more tables. |
java.util.Vector |
getTargets()
Gets all targets configured for MIB Explorer. |
boolean |
isTarget(java.lang.String target)
Checks whether a String represents a target. |
java.lang.Integer |
send()
Send the current request PDU. |
boolean |
setCurrentTarget(java.lang.String targetString)
Sets the target to be used for subsequent SNMP operations. |
void |
setCurrentTargetsAddress(java.lang.String address)
Sets the target UDP address of the current target which is represented as "a.b.c.d:port" or "a.b.c.d/port". |
void |
setPduDirectory(java.lang.String path)
Sets the directory to search for PDUs. |
void |
setRequestPdu(PDU pdu)
Sets the PDU to be used for subsequent requests. |
java.lang.Boolean |
setRequestPdu(java.lang.String pduPath)
Sets the PDU to be used for subsequent requests by giving the file name of a MIB Explorer PDU file. |
void |
setRequestType(java.lang.String requestType)
Set the request type of the current request PDU. |
Method Detail |
---|
java.lang.String getCurrentTarget()
send
.
boolean setCurrentTarget(java.lang.String targetString)
targetString
- a String identifying a target.
true
if the target could be found and set.void setCurrentTargetsAddress(java.lang.String address)
address
- an UDP address string, for example "127.0.0.1:161".java.lang.String getDefaultTarget()
java.util.Vector getTargets()
boolean isTarget(java.lang.String target)
target
- a String.
VariableBinding getRequestVariable(java.lang.String objectName)
objectName
- a String representing an OID (object identifier) as dotted string. The
first subidentifier may be an object name from a loaded MIB module.
void setPduDirectory(java.lang.String path)
path
- a String representing an absolut path to a directory.java.lang.String getPduDirectory()
java.lang.Boolean setRequestPdu(java.lang.String pduPath)
pduPath
- a String denoting the relative or absolut path of a MIB Explorer PDU
file. If pduPath is relative it will be appended to the PDU directory
set via setPduDirectory (this is the last used MIB Explorer PDU
directory by default).
true
when the PDU could be found and loaded,
false
otherwise.void setRequestPdu(PDU pdu)
pdu
- a PDU instance.PDU getRequestPdu()
void createEmptyRequestPdu()
setRequestType
.
void setRequestType(java.lang.String requestType)
requestType
- a String with one of the following values (without quotes):
"GET", "GETNEXT", "GETBULK", "SET", "TRAP", "INFORM".java.lang.Integer send()
java.util.List getTable(java.util.List columnOIDs, java.lang.String lowerBoundIndex, java.lang.String upperBoundIndex)
TableRow
instances. Each instance represents a row (or an error condition).
The OIDs of the columnar objects have to be specified for which instances
should be retrieved. You can use Utils.createVector()
to
create an empty list and then add the column OID strings to it. The OID
strings may contain object names (e.g. "ifType") that are resolved to OIDs
automatically (if the name is know to MIB explorer).
With a lower bound index and an upper bound index, the result set can be narrowed to improve performance.
columnOIDs
- a List (Vector) of column OIDs (without index part!).lowerBoundIndex
- a lower bound index value or null
or an empty string if
no lower bound should be specified.upperBoundIndex
- String
an upper bound index value or null
or an empty string if
no upper bound should be specified.
tableEvent.getStatus()
returns 0, you can access the rows index get calling
getIndex()
and the VariableBindings by
getColumns()
.java.util.List getTable(java.util.List columnOIDs, java.lang.String lowerBoundIndex, java.lang.String upperBoundIndex, int maxRepetitions)
TableRow
instances. Each instance represents a row (or an error condition).
The OIDs of the columnar objects have to be specified for which instances
should be retrieved. You can use Utils.createVector()
to
create an empty list and then add the column OID strings to it. The OID
strings may contain object names (e.g. "ifType") that are resolved to OIDs
automatically (if the name is know to MIB explorer).
With a lower bound index and an upper bound index, the result set can be narrowed to improve performance.
columnOIDs
- a List (Vector) of column OIDs (without index part!).lowerBoundIndex
- a lower bound index value or null
or an empty string if
no lower bound should be specified.upperBoundIndex
- String
an upper bound index value or null
or an empty string if
no upper bound should be specified.maxRepetitions
- the maximum number of rows to be retrieved per (internal) GETBULK
request. For SNMPv1 this value is alwas one, because GETNEXT is used.
tableEvent.getStatus()
returns 0, you can access the rows index get calling
getIndex()
and the VariableBindings by
getColumns()
.java.lang.Integer getErrorStatus()
send
java.lang.String getErrorStatusText()
send
java.lang.Integer getErrorIndex()
PDU getResponsePdu()
PDU duplicate(PDU pdu)
pdu
- the PDU to duplicate.
pdu
for the current target.java.lang.Integer getSnmpVersion()
java.lang.String getScriptName()
|
Copyright 2003-2011, Frank Fock, All Rights Reserved. http://www.mibexplorer.com | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |