Advent SNMP FAQ
QUESTIONS
- What do I need to start developing applications and applets in Java using the Advent SNMP Package?
- What do I need to view and use the MIB Browser Applet?
- What can I do to improve performance?
- Why does the MIB Browser Applet fail to work in my Netscape Browser?
- What are the reasons for the socket access restrictions in Netscape, and can we expect it to change in the near future?
- Why does using IP addresses instead of hostnames fail in many cases?
- For what platforms is the JDK available?
- What is the best way to learn Java?
- What are the best sources of information on SNMP?
Advent SNMP Package
- How do I use asynchronous communication to SNMP peers?
- How do I use callbacks when SNMP PDUs are received?
- How can I prevent MIB parsing failures on account of IMPORTS not found?
- What is the SASClient class and how is it used?
- What do I do with the MIBException and SnmpException exceptions?
- Why do I need the SnmpUnsignedInt, ASNTypes and MIBMacro classes?
- Why is that I get a out of memory error when I use the Advent SNMP package?
- How do I make my applet try and connect to the SAS server when it is loaded through the web server?
- Why is that my applet does not seem to connect to the SAS server even though the SAS server is running in my web server host?
- Why do I get an Applet Security exception when I load a mib file in the mibbrowser?
- Why is it that when I do a set operation in the MIB Browser I get a "No Mib Node, Dont know Type. Cannot perform set operation" error ?
- Why do I get a classFormatError when I load a class?
ANSWERS
- What do I need to start developing applications and applets in Java using the Advent SNMP Package?
You will need the Java
Developers Kit (JDK), or an equivalent Java development tool
like Symantec Cafe or MS Visual J++, to develop applications and applets
using this Advent SNMP Package.
You will also need to
download and setup the Advent SNMP Package classes.
- What do I need to view and use the MIB Browser Applet?
You will need
a Java enabled web browser like
Netscape Navigator or
MS Internet Explorer 3.0 final,
or the Java Developers
Kit (JDK) appletviewer.
Please see the setup section
in the tutorial for more details.
- What can I do to improve performance?
The best performance for Java applets that we've seen is with the
Netscape Navigator or
MS Internet Explorer 3.0 final,
loading all classes locally and not over the network.
Furthermore, having all classes in the browser CLASSPATH or java classes
directory, is fastest and does not have security restrictions.
Network loading of classes is somewhat slower, and depends on
the speed of your network to the web server.
- Why does the MIB Browser Applet fail to work in my Netscape Browser?
If you're loading the Java classes and applet HTML file locally off
your own filesystem,
you need to invoke your web browser with your CLASSPATH set right.
This is the most common cause of problems.
If you are loading classes over the network,
Netscape Navigator and
MS Internet Explorer 3.0 final,
will not allow any communication except to the host
from which you loaded your applet. In order to get this to work, you will
need to use a Java application on your applet host (Web Server) called
the SNMP applet server (SAS).
Please see the setup section in the tutorial
for more details.
- What are the reasons for the socket access restrictions in Netscape, and can we expect it to change in the near future?
Java has been designed to be secure in an environment where you
run unknown and untrusted applets in your browser from untrusted sites,
and expect that these applets have no way to harm your system or your co-workers
system. If applets were allowed free access to connect to any host, they
could connect to your system, or some other system and compromise security.
Unfortunately this goal has led to us getting the lowest common denominator
even when we run trusted applets. Therefore, if you build an applet you
are still constrained by not being able to connect to any host but the
applet host. There are changes coming to allow for signed applets,
that do not have these restrictions.
- Why does using IP addresses instead of hostnames fail in many cases?
There is a bug in JDK 1.0.2, and in some other Java implementations,
that creates an unknown host error when IP addresses are used
instead of hostnames. There is a patch available for this at
ftp://ftp.adventnet.com/users/advent/InetAddress.class.
This needs to be placed in a java/net/ sub-directory in one of
the directories in your CLASSPATH before the JDK classes.zip
file.
- For what platforms is the JDK available?
As of this writing the JDK is available on a number of platforms, including
Solaris, Windows 95, Windows NT, MacOS,
HP-UX,
Linux,
AIX,
and OS/2 from different sources.
You could also use one of a number of Java development tools
e.g. Symantec Cafe, MS Visual J++, etc.
which provide the functionality of the JDK.
- What is the best way to learn Java?
Check out the Javasoft site,
which has API documentation and a tutorial. You'll find the tutorial a
good place to start, and then you can use the API docs,
or javadoc Package documentation
as a great reference while you're writing code. As with any language, the
best way to learn is to use it and build applications and applets. You
may find, as we did, that this is a really cool language.
- What are the best sources of information on SNMP?
We'd recommend taking a look at the following sites for
more information
(though there may be better sites we don't know about).
SNMP
FAQ
Network Management
Advent SNMP Package
- How do I use asynchronous communication to SNMP peers?
The SnmpSession class provides
a number of methods to handle asynchronous and synchronous communication
with SNMP peers. For example, both a syncronous and asynchronous form of
send request PDUs exists.
When using the asynchronous send, the call returns right away.
You will need to use the checkResponses() methods on each session,
or on all sessions attached to a SnmpAPI instance with the
equivalent call in the SnmpAPI class..
Methods exist to check for responses or timeouts.
And callbacks are available when PDUs are received. Please see the Package
documentation for more detail.
- How do I use callbacks when SNMP PDUs are received?
Callbacks are used by implementing the SnmpClient
interface. This is the interface implemented by client programs that wish
to use callback, authentication, and debugging functions of the API.
Once you have an instance of SnmpClient, set the client variable
in SnmpAPI to the SnmpCLient instance.
- How can I prevent MIB parsing failures on account of IMPORTS not
found?
If an Object ID, Textual Convention, or syntax, is needed from
another module, you will need to first load and parse that module. In some
cases, the required element is already loaded by default in every module
before parsing begins, e.g. DisplayString. In such cases just having an
empty MIB module file with module name referenced in the IMPORTS, and a
BEGIN and END, will suffice. See rfc1155-SMI for example, which is probably
the most common case where you'll need to do this.
- What is the SASClient class and how is it used?
Part of the SNMP communication classes is an SASClient
class for enabling communication for applets on Java browsers that do not
permit socket access to any host but the applet host. You will not need
to use this class directly, but will be able to decide if it get's used
through the open method in the SnmpSession class. The only methods
in SASclient you may need to use are the saveFile and
appendFile methods, useful
for saving applet data to a file on the Web Server.
- What do I do with the MibException and SnmpException exceptions?
Not a lot. They're intended to let you know of MIB parsing and
SNMP communication problems. For the most part you can only catch these
exceptions, print the error and carry on or exit. Check the tutorial examples
to see some examples of catching and printing exceptions.
- Why do I need the SnmpUnsignedInt, ASNTypes and MIBMacro classes?
You dont. These classes are used by the other classes in the package.
- Why is that I get a out of memory error when I use the Advent SNMP package?
It is possible that you are opening and closing the api and session thread
for every pdu you send out. Creating and stopping threads puts too much of overhead
in the system. So start the api thread only once and if possible open the snmp session
only once to send and receive multiple pdus.
One more reason could be that the garbage collector in the Sun JDK is not perfect. Try calling the
System.gc() directly.
- How do I make my applet try and connect to the SAS server when it is loaded through the web server?
When you open the snmp session in your applet, use the SnmpSession.open(api)
instead of SnmpSession.open(). This will automatically try and connect to the SAS server
if it is alive.
- Why is that my applet does not seem to connect to the SAS server even though the SAS server is running in my web server host?
The SAS server creates a file called SASocketPort when it is stared. The applet
looks for that file to get the port number it has to use to connect to the SAS server.
The file has to be created in the same directory where your applet html file is there.
Use the -d option to specify the directory for the SASocketPort file and make sure this
directory is where your applet html file is.
- Why do I get an Applet Security exception when I load a mib file in the mibbrowser?
Its beacuse, your applet classes are not in the classpath. If your applet is
loaded from the code base in your html file and if this code base directory is not
in you classpath, then you cannot read/write files nor you can connect to any
remote hosts.
- Why is it that when I do a set operation in the MIB Browser I get a "No Mib Node, Dont know Type. Cannot perform set operation" error?
With the MIB browser, unless it knows what type the SNMP variable
is, e.g. INTEGER, COUNTER, STRING, etc., it cannot send
a set request. So you cannot do sets with the MIB browser
unless the MIB file is loaded.
- Why do I get a classFormatError when I load a class?
This means there the class file is corrupted. If you have downloaded it from
the net, try downloading it again. If you have access to the source, compile
it and try again.
