|
I am able to perform an SNMP GET successfully but I get an error if I perform an SNMP SET. Why?
When I make a getrequest for a particular OID using MibBrowser, I get the desired result whereas for the same OID if I make a getrequest from the command line I get a "no such variable name in the MIB" error. Why is this so?
How many requests, each from a different thread, can I make in the same JVM?
What would be the maximum packet size supported by AdventNet SNMP stack and how do I find this number?
How many SnmpSession instances can I open in a single SnmpAPI?
Do the sizes of a datagram vary, or are they of constant size?
What are the advantages of sending individual GETs compared to sending GETs with multiple OIDs?
I wish to build a standalone Java application by using AdventNet SNMP API. If Java is not installed, what is the approximate size of the support files that need to be installed to support the Java application?
If multiple requests are sent to the same destination [agent] through multiple threads concurrently, does the SNMP stack serialize them? Or does it treat them as separate requests and assign a port per request?
Is there a way by which I can ensure that the SNMP commands come only through AdventNet and not through a source that uses my 161 port? Can I disable SNMP to everyone but AdventNet?
Suppose a response comes back in 4.9 seconds on an SNMP timeout of 5 seconds. However, the CPU being very busy causes a delay of 0.2 seconds before picking up the response from the incoming buffer. In this case, would the response be used or would a timeout situation occur?
I get "out of environment space" error when I try to start the example application batch files in Windows. What should I do?
1. I am able to perform an SNMP GET successfully but I get an error if I perform an SNMP SET. Why?
Load the corresponding MIB file to perform the SNMP SET operation. This solves the problem. Loading the MIB is a must because the type of the object is retrieved from the MIB file.
To perform a SET operation, we need the OID, type, and value. If you load the corresponding MIB file, the API finds the type of the OID from the MIB. If the MIB file is not available, we need to either load the MIB file or explicitly give the type of the object. Go through the examples given in examples/low_level_api_examples/snmpapps, examples/low_level_api_examples/mibapps and in the examples/applications/ directory. Except the examples given in examples/low_level_api_examples/snmpapps directory, all other examples have the option for specifying the MIBs to be loaded. For snmpset and trap examples, loading the MIB is a must. Loading MIB files is normally done by using the -m option. The following is a sample usage of the SNMP SET command.
|
java snmpset -m "../mibs/RFC1213-mib" 10.3.2.120 sysLocation.0 paradise sysName.0 whatever
|
If you develop an application for performing SNMP SET, loading MIB files can be done by using loadMibs() of the MibOperation class in the mibs package.
It is also possible to develop applications without loading MIB files. This can be done using one of the following Beans package API methods.
snmpSetVariable(SnmpVar var) - specifying the OID and the corresponding value.
snmpSetVariables(SnmpVar[] values) - specifying a list of OIDs and their corresponding values. This can be used while performing SET operations on multiple OIDs.
snmpSet(String value, byte type) - specifying the OID value to SET and the OID type. This method is easiest to use in case of the SET operation on a single OID.
The advantage of using the MIB file is that you need not know the OID type. It is automatically read from the MIB file.
2. When I make a getrequest for a particular OID using MibBrowser I get the desired result whereas for the same OID if I make a getrequest from the command line I get a "no such variable name in the MIB" error. Why is this so ?
If the OID is a scalar, MibBrowser appends a ".0 " to it and performs the getrequest. To specify an object to an SNMP agent, both the OID (which defines the type of object) and the instance (which defines the specific object of the given type) need to be provided. From the MIB, you get the OID to which an instance needs to be added. For non-tabular or scalar objects, this is an instance of "0" (e.g. sysDescr.0 or .1.3.6.1.2.1.1.1.0 ). For tabular objects, the instance is defined by the MIB, and is a sequence of one or more variables (e.g. ifInOctets.2 or tcpConnState.179.74.15.126.1192.225.226.126.197.80).
In order to GET and SET SNMP variables, you need to completely specify the OID and the instance. However, you can use GETNEXT and specify the OID from the MIB (e.g. sysDescr) and get the first instance of that type from the SNMP agent. This works for all types of objects.
The following usage gives you an error,
|
java snmpget localhost .1.3.6.1.2.1.1.1 |
while the following usage gives the proper result.
|
java snmpget localhost .1.3.6.1.2.1.1.1.0 |
3. How many requests, each from a different thread, can I make in the same JVM?
You can go safely till 100-150 threads in a standard machine (64 MB, 233 MHz).
4. What would be the maximum packet size supported by AdventNet SNMP stack and how do I find this number?
The maximum packet size supported is 64KB. The methods getPacketBufferSize() and setPacketBufferSize() of SnmpSession is used to get and set the packet size of the response PDU. However, this also depends on the maximum size the agent can handle.
If the size exceeds the limit, the agent sends the manager a GetResponse-PDU with the value of error-status field "too big". In this case, you need to split the PDU into multiple requests and send them. Refer PDU Splitting for further details.
5. How many SnmpSession instances can I open in a single SnmpAPI?
Each instance of SnmpSession takes resources. It is better to share the same session instance because apart from additional threads, each session also uses socket resources.
6. What are the PDU timeout units?
The PDU timeout values in SnmpPDU class and the SnmpSession are specified in milliseconds. All the Beans components, on the contrary, use time parameters in seconds while internally the PDU timeout parameters are set in milliseconds. The SnmpPoller bean, MibBrowser bean, etc. accept time values in seconds.
7. Do the sizes of a datagram vary, or are they of constant size?
The datagram size is not a constant. It varies and the size depends on the number of the varbinds. The default underlying protocol used by AdventNet SNMP API is User Datagram Protocol (UDP). The maximum message size of a UDP packet is 64 KB. Therefore, the API could not receive packets of length greater than this value.
8. What are the advantages of sending GETs with multiple OIDs over GETs with individual OIDs?
To minimize overhead and maximize throughout you should always send as many GETs in a PDU as you can (within the limits of the maximum UDP frame size of your network). The more UDP frames you send, the higher the chance for collision and the longer it takes to get the information. The real overhead is in the reception and transmission of the frame and not in the assembly and disassembly of a PDU with multiple requests.
9. I wish to build a standalone Java application by using AdventNet SNMP API. If Java is not installed, what is the approximate size of the support files that need to be installed to support the Java application?
The user needs AdventNetSnmp.jar (approx. 1.5 MB) and jre1.1 (approx. 2.6 MB) from Sun MicroSystems. If you distribute our package, please read the Copyrights carefully or contact sales@adventnet.com for more details.
10. If multiple requests are sent to the same destination [agent] through multiple threads concurrently, does the SNMP stack serialize them? Or does it treat them as separate requests and assign a port per request?
The SNMP stack does not serialize the requests. Ultimately, the DatagramSocket takes care of this. The DatagramSocket is opened once per session and it binds to the available port on the local machine. Concurrent requests are sent through this port. The responses can come in any order and they are matched to the request based on the request ID. Also, the DatagramSocket.receive() method is synchronized. Therefore, all the requests are sent concurrently and the responses are processed one by one inside synchronized methods in the order in which they are received.
11. Is there a way by which I can ensure that the SNMP commands come only through AdventNet and not through a source that uses my 161 port? Can I disable SNMP to everyone but AdventNet?
There is no way to ensure that the SNMP commands come from a particular SNMP entity. SNMP standards do not define any method/procedure for this. The only way is to authenticate the community string, where SNMP messages from an SNMP entity can be sent with a particular community.
12. Suppose a response comes back in 4.9 seconds on an SNMP timeout of 5 seconds. However, the CPU being very busy causes a delay of 0.2 seconds before picking up the response from the incoming buffer. In this case, would the response be used or would a timeout situation occur?
In this case, a timeout situation occurs.
13. I get "out of environment space" error when I try to start the example application batch files in Windows. What should I do?
This has been a problem with the Windows environment variable settings. To overcome this, you have to modify the properties of your DOS prompt. You need to right-click of the titlebar of the DOS prompt window and select Properties. Choose memory tab in the Properties dialog box and increase the value of the initial environment field (preferably 4096). It can also be solved by adding the following entry in config.sys file.
|
SHELL=C:\Windows\COMMAND.COM/P/E:4096 |
|