Re: perl usage of the $session->getbulk()

Carl Hayter <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On Thu, Oct 05, 2006 at 11:52:14AM +0200, Harrie Hazewinkel wrote:
...snip...
> It returns a list, but is I print the perticular items
> of the list, I just get the value. It there not some
> way I can get the varbind and then have OID/value?

$vars = SNMP::VarList->new( ['ifDescr'], ['ifSpeed'] );
@result = $sess->getbulk( 0, 3, $vars );

use Data::Dumper;
print Dumper(\@result);
print Dumper($vars);

__END__

The @result has just the values for the request, but the $vars are
updated to contain everything.

$VAR1 = [
          'lo0',
          '0',
          'dp0',
          '100000000',
          'Enterasys RoamAbout 4102 Wireless Interface a: (802.11a)',
          '54000000'
        ];
$VAR1 = bless( [
                 bless( [
                          'ifDescr',
                          '1',
                          'lo0',
                          'OCTETSTR'
                        ], 'SNMP::Varbind' ),
                 bless( [
                          'ifSpeed',
                          '1',
                          '0',
                          'GAUGE'
                        ], 'SNMP::Varbind' ),
                 bless( [
                          'ifDescr',
                          '2',
                          'dp0',
                          'OCTETSTR'
                        ], 'SNMP::Varbind' ),
                 bless( [
                          'ifSpeed',
                          '2',
                          '100000000',
                          'GAUGE'
                        ], 'SNMP::Varbind' ),
                 bless( [
                          'ifDescr',
                          '3',
                          'Enterasys RoamAbout 4102 Wireless Interface a: (802.11a)',
                          'OCTETSTR'
                        ], 'SNMP::Varbind' ),
                 bless( [
                          'ifSpeed',
                          '3',
                          '54000000',
                          'GAUGE'
                        ], 'SNMP::Varbind' )
               ], 'SNMP::VarList' );

----
Carl Hayter
Data Network Operations
University of Southern California

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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.