Hello.

I've recently been using (quite extensively) both the Net::SNMP and the
SNMP::MIB::Compiler modules to manage several network devices.  However,
to interface the two modules is slightly unwieldly, since they don't tie
together.  As a result, I have developed a new module, called
'SNMP::Utils' which provides the "glue" between SNMP::MIB::Compuler and
Net::SNMP.

I'd like to contribute this to CPAN, however I notice that the SNMP
namespace is a bit strange.  It looks like there are sort of two
"threads", one which goes along the lines of SNMP::MIB::Compiler (which
goes along the lines of Net::SNMP), which provides native Perl interfaces
to SNMP, and another which links in to UCD SNMP.

I'm really trying to figure out where to stick this...and get some
feedback that where I put it isn't nasty :-).  I was considering
Net::SNMP::Utils (which moves along the thread that SNMP::MIB::Compiler
would move to Net::SNMP::Mib or some such thing).

I've also attached the perldoc for this module, so you get an idea of what
it does...

thoughts?

thanks.

chander
Utils(3)       User Contributed Perl Documentation       Utils(3)



NNAAMMEE
       SNMP::Utils - Perl utility module to tie together
       SNMP::MIB and Net::SNMP modules.

SSYYNNOOPPSSIISS
         use SNMP::Utils;
         my $snmpUtil = new SNMP::Utils;
         my $result = $snmpUtil->getSNMPTable(-snmp => $snmp,
                                           -name => \@name);
         my $name = $snmpUtil->convert_oid('1.3.6.1.2.1');
         my $oid = $snmpUtil->resolve_oid('dot1StPPortTable');
         my $enumtxt = $snmpUtil->convert_enum('dot1dStpPriority', 5);
         my $enum = $snmpUtil->convert_enum ('dot1dStpPriority', $enumtxt);
         my $value = $snmpUtil->get_value (-snmp => $snmpObj,
               -name => "dot1dStpPortPriority",
               -instance => 3);
         my $result = $snmpUtil->set_value(-snmp => $snmpObj,
               -name => "dot1dStpPortPriority",
               -instance => 3,
               -value => 2);


DDEESSCCRRIIPPTTIIOONN
       SNMP::Utils is a set of management utility functions that
       tie Net::SNMP together with SNMP::MIB.  It provides a link
       between the Net::SNMP module and the MIB, performing con-
       versions from numeric OID's to textual identifiers.

       AAcccceessss


       $snmpUtil=new SNMP::Utils;
           Create a new SNMP::Utils object.

       set_value(-snmp => Net::SNMP object, -name => 'objname',
       -value => "value", -instance => "1-4,6")
           Set a value and return the result (set value).

           Instance can be specified as a reference to an array
           of ports, a range of instances '1-4' would be
           instances 1,2,3,4 or a single instance (scalar value).
           Instances of 1-4,3,3,9 would result in 1,2,3,4,3,3,
           and 9 (3 would be set thrice, but only the last return
           code would be returned!!).

           In the case of a single instance, the response will be
           a scalar with the result (or undef on failure).

           In the case of multiple instances, the response will
           be two hashes of the form 'Instance' => 'value' .
           Failed instances will be undefined.
            The second hash will be of the same form, but will
           contain only errors returned (on failure).

           In the case of a single set, the exercise of checking
           the return code is left to the user.

       get_value (-snmp => Net::SNMP object, -name => "objname",
       -instance => 1)
           Retrieve the value and return the result.  Unlike
           set_value, instances are currently not supported here.

       convert_enum ('objName', value)
           Performs conversions of enum values from numeric to
           textual and vice versa.  If b<value> is a number, it
           will be converted to its textual equivalent if it
           exists.  If b<value> is a text string, it will be con-
           verted to its numeric equivalent if it exists.

           If no enums exist for the b<objName> specified, then
           the value returned will be undefined.  The same is
           true if the avlue is invalid (not defined in the enum
           table).

       add_path
       add_extension
       repository
       compile
       tree
           These functions are all inherited from the
           SNMP::MIB::Compiler module.  Please refer to the
           SNMP::MIB::Compiler documentation for their usage syn-
           tax.

       getSNMPTable(-snmp => Net::SNMP object, -name => 'obj-
       name')
           Takes a table name as an argument, retrieves it, and
           returns the results in a hash.  Each element of the
           response hash in turn contains a hash with the results
           of the retrieve.

           A Net::SNMP object must be provided for this call.

EEXXPPOORRTT
       None by default.  This module should be called only using
       object oriented methods.

AAUUTTHHOORR
       Chander Ganesan <[EMAIL PROTECTED]>

SSEEEE AALLSSOO
       perl.

       Net::SNMP.

       SNMP::MIB::Compiler



perl v5.6.1                 2002-12-24                   Utils(3)

Reply via email to