Perl scripts need two use statements to take advantage of the SNMP Perl module:
The BER and SNMP_Session modules make up the core of Simon's package. The SNMP_util module discussed in this appendix makes using this package a little easier. It requires only one use statement:use BER; use SNMP_Session;
Mike's package uses the other two modules, so it's not necessary to include all three in your scripts.use SNMP_util;
All the parameters are strings. text is the textual (or symbolic) name that you want to use and OID is the numeric object ID of the object to which the name refers. A single call to this routine may specify any number of name-OID pairs.snmpmapOID(text, OID, [text, OID...])
If snmpmapOID() fails it returns undef, so you can test for errors like this:
@return = snmpmapOID(..); if(!@return) { # error }
snmpMIB_to_OID(filename)
This is much faster than calling snmpMIB_to_OID() because it doesn't require parsing a MIB file. The only argument to this routine is the name of the file that contains the preparsed data:textual_name OID
snmpLoad_OID_Cache() returns -1 if it can't open the file; a return value of 0 indicates success.snmpLoad_OID_Cache(filename)
snmpQueue_MIB_File(filename, [filename])
Copyright © 2002 O'Reilly & Associates. All rights reserved.