SNMP.pm / specifying MIB module as well as the leaf identifier

Stuart Kendrick <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Is it possible to hand the MIB module plus the leaf identifier to the Perl 'get' 
method?


This works:
$oid = 'ifDescr';
$val = $session->get($oid};

This does not:
$oid = 'IF-MIB::ifDescr';
$val = $session->get($oid};

failing with the following error:

error: get: unknown object ID (IF-MIB) at /usr/local/lib/perl5/site_perl/5.10.1/
x86_64-linux-thread-multi/SNMP.pm line 663.


I would like to do this because one of the enterprise MIB modules I load 
(Broadcom) ... defines ifDescr (and ifName).

I tried setting 'UseLongNames' to 1 ... didn't help ... I'm guessing that this 
affects output rather than input.

net-snmp-5.5
perl-5.10.1

--sk

Stuart Kendrick
FHCRC

Longer snippet of code below:


   # Define SNMP session
   $session = new SNMP::Session (    Community      =>  $read,
                                     DestHost       =>  $host,
                                     RemotePort     =>  $port,
                                     Retries        =>  $retries,
                                     UseSprintValue =>  $translate,
   				    UseLongNames   =>  $long_names,
                                     Timeout        =>  $timeout,
                                     Version        =>  $version
                                 );
   unless (defined $session) {
     print_it("Cannot build SNMP object for $host");
     return;
   }

   # Perform the get
   $val = $session->get($oid);
   $error = $session->{ErrorStr};
   undef $error if $error eq $EMPTY_STR;

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.