Hi all,

I get incomplete data with perl bulkwalk. I'm using net-snmp version 5.2.1
and I'm working based on bulkwalk.pl example version 5.0 2002/04/20. The OS
is linux 2.4.21 RedHat distro.

Specifically, I'm requesting multiple varbinds at one bulkwalk, a cisco
proprietary table cardIfIndexEntry and ifXEntry. I captured the SNMP packets
with tcpdump and they look ok. The perl output though lacks the first
binding per SNMP response packet, but only after the cardIFIndexEntry is
exhausted (see bellow for details). Check for example that tcpdump captures
a response for OID 31.1.1.1.1.41 which does not appear in the perl output.

Please advise.
Thank you in advance,

Eleni




perl script
=============================
#!/usr/bin/perl

#use strict;
use SNMP;


###- INITIALIZE -###

my $hostipaddr = shift;
if (!defined $hostipaddr) { 
        printf ("usage: get-stats-if.pl IPAddr\n");
        exit 0;
}


###- INITIALIZE SNMP -###

my $port='161';
my $community='eleni';

$SNMP::debugging = 0;
$SNMP::dump_packet = 0;

$sess = new SNMP::Session( 'DestHost'   => $hostipaddr,
                           'Community'  => $community,
                           'RemotePort' => $port,
                           'Timeout'    => 300000,
                           'Retries'    => 3,
                           'Version'    => '2c',
                           'UseLongNames' => 1,    # Return full OID tags
                           'UseNumeric' => 1,      # Return dotted decimal
OID
                           'UseEnums'   => 0,      # Don't use enumerated
vals
                           'UseSprintValue' => 0); # Don't pretty-print
values

die "Cannot create session: ${SNMP::ErrorStr}\n" unless defined $sess;

my $vars = new SNMP::VarList(   ['sysUpTime'],          # statistics

                                # cardIfIndexEntry in OLD-CISCO-CHASSIS
                                [".1.3.6.1.4.1.9.3.6.13.1.2"],
                                [".1.3.6.1.4.1.9.3.6.13.1.3"],

                                # ifXEntry in ifMIB (RFC2233)
                                ['ifXEntry'] );


###- DO SNMP BULKWALK -###

# get the time
($sec,$min,$hour,$day,$mon,$year) = localtime(time);
my $ptime = sprintf("%02s-%02s-%02s %02s:%02s:%02s", $year+1900, $mon+1,
$day, $hour, $min, $sec);

# do the bulkwalk
@resp = $sess->bulkwalk(1, 16, $vars);
die "Cannot do bulkwalk: $sess->{ErrorStr} ($sess->{ErrorNum})\n" if
$sess->{ErrorNum};


###- PARSE SNMP OUTPUT -###

# iterate per requested SNMP object
for $vbarr ( @resp ) {

    $oid = $$vars[$i++]->tag();

    # display SNMP output
    $num = scalar @$vbarr;
    print "$num responses for oid $oid: \n";

    # iterate per returned SNMP object instance
    for $v (@$vbarr) {
        printf("\t%s = %s (%s)\n", $v->name, $v->val, $v->type);
    }

    print "\n";
}

exit 0;


perl output
=============================
1 responses for oid sysUpTime: 
        .1.3.6.1.2.1.1.3.0 = 1811653712 (TICKS)

16 responses for oid .1.3.6.1.4.1.9.3.6.13.1.2: 
        .1.3.6.1.4.1.9.3.6.13.1.2.1 = 0 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.2 = 0 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.3 = 1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.4 = 1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.5 = 1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.6 = 1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.7 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.8 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.9 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.10 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.11 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.12 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.13 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.14 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.15 = -1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.2.16 = 2 (INTEGER)

16 responses for oid .1.3.6.1.4.1.9.3.6.13.1.3: 
        .1.3.6.1.4.1.9.3.6.13.1.3.1 = 0 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.2 = 1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.3 = 0 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.4 = 1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.5 = 2 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.6 = 3 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.7 = 0 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.8 = 1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.9 = 2 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.10 = 3 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.11 = 4 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.12 = 5 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.13 = 6 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.14 = 7 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.15 = -1 (INTEGER)
        .1.3.6.1.4.1.9.3.6.13.1.3.16 = 0 (INTEGER)

767 responses for oid ifXEntry: 
        .1.3.6.1.2.1.31.1.1.1.1.1 = Fa0/0 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.2 = Fa0/1 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.3 = Se1/0 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.4 = Se1/1 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.5 = Se1/2 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.6 = Se1/3 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.7 = Se4/0 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.8 = Se4/1 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.9 = Se4/2 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.10 = Se4/3 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.11 = Se4/4 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.12 = Se4/5 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.13 = Se4/6 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.14 = Se4/7 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.15 = Nu0 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.16 = E1 2/0 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.25 = Se2/0:0 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.26 = Se2/0:1 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.27 = Se2/0:2 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.28 = Se2/0:3 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.29 = Se2/0:4 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.30 = Se2/0:5 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.31 = Se2/0:6 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.32 = Se2/0:7 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.33 = Se2/0:8 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.34 = Se2/0:9 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.35 = Se2/0:10 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.36 = Se2/0:11 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.37 = Se2/0:12 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.38 = Se2/0:13 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.39 = Se2/0:14 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.40 = Se2/0:15 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.42 = Se2/0:17 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.43 = Se2/0:18 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.44 = Se2/0:19 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.45 = Se2/0:20 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.46 = Se2/0:21 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.47 = Se2/0:22 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.48 = Se2/0:23 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.49 = Se2/0:24 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.50 = Se2/0:25 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.51 = Se2/0:26 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.52 = Se2/0:27 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.53 = Se2/0:28 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.54 = Se2/0:29 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.55 = Se2/0:30 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.56 = Se2/0:15 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.58 = Se2/0:1 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.59 = Se2/0:2 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.60 = Se2/0:3 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.61 = Se2/0:4 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.62 = Se2/0:5 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.63 = Se2/0:6 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.64 = Se2/0:7 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.65 = Se2/0:8 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.66 = Se2/0:9 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.67 = Se2/0:10 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.68 = Se2/0:11 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.69 = Se2/0:12 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.70 = Se2/0:13 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.71 = Se2/0:14 (OCTETSTR)
        .1.3.6.1.2.1.31.1.1.1.1.72 = Se2/0:16 (OCTETSTR)

[... stuff deleted]


tcpdump output
=============================
16:27:08.720421 eleni1.1112 > eleni2.snmp:  C=eleni GetBulk(76)  N=1 M=16
system.sysUpTime E:cisco.3.6.13.1.2 E:cisco.3.6.13.1.3 31.1.1.1 (DF)
16:27:09.025785 eleni1.1112 > eleni2.snmp:  C=eleni GetBulk(76)  N=1 M=16
system.sysUpTime E:cisco.3.6.13.1.2 E:cisco.3.6.13.1.3 31.1.1.1 (DF)
16:27:09.059987 eleni2.snmp > eleni1.1112:  C=eleni GetResponse(993)
system.sysUpTime.0=1811376290 E:cisco.3.6.13.1.2.1=0 E:cisco.3.6.13.1.3.1=0
31.1.1.1.1.1="Fa0/0" E:cisco.3.6.13.1.2.2=0 E:cisco.3.6.13.1.3.2=1
31.1.1.1.1.2="Fa0/1" E:cisco.3.6.13.1.2.3=1 E:cisco.3.6.13.1.3.3=0
31.1.1.1.1.3="Se1/0" E:cisco.3.6.13.1.2.4=1 E:cisco.3.6.13.1.3.4=1
31.1.1.1.1.4="Se1/1" E:cisco.3.6.13.1.2.5=1 E:cisco.3.6.13.1.3.5=2
31.1.1.1.1.5="Se1/2" E:cisco.3.6.13.1.2.6=1 E:cisco.3.6.13.1.3.6=3
31.1.1.1.1.6="Se1/3" E:cisco.3.6.13.1.2.7=4 E:cisco.3.6.13.1.3.7=0
31.1.1.1.1.7="Se4/0" E:cisco.3.6.13.1.2.8=4 E:cisco.3.6.13.1.3.8=1
31.1.1.1.1.8="Se4/1" E:cisco.3.6.13.1.2.9=4 E:cisco.3.6.13.1.3.9=2
31.1.1.1.1.9="Se4/2" E:cisco.3.6.13.1.2.10=4 E:cisco.3.6.13.1.3.10=3
31.1.1.1.1.10="Se4/3" E:cisco.3.6.13.1.2.11=4 E:cisco.3.6.13.1.3.11=4
31.1.1.1.1.11="Se4/4" E:cisco.3.6.13.1.2.12=4 E:cisco.3.6.13.1.3.12=5
31.1.1.1.1.12="Se4/5" E:cisco.3.6.13.1.2.13=4 E:cisco.3.6.13.1.3.13=6
31.1.1.1.1.13="Se4/6" E:cisco.3.6.13.1.2.14=4 E:cisco.3.6.13.1.3.14=7
31.1.1.1.1.14="Se4/7" E:cisco.3.6.13.1.2.15=-1 E:cisco.3.6.13.1.3.15=-1
31.1.1.1.1.15="Nu0" E:cisco.3.6.13.1.2.16=2 E:cisco.3.6.13.1.3.16=0
31.1.1.1.1.16="E1 2/0"

16:27:09.062515 eleni1.1112 > eleni2.snmp:  C=eleni GetBulk(67)  N=0 M=16 
E:cisco.3.6.13.1.2.16 E:cisco.3.6.13.1.3.16 31.1.1.1.1.16 (DF)
16:27:09.095591 eleni2.snmp > eleni1.1112:  C=eleni GetResponse(1014)
E:cisco.3.6.13.1.3.1=0 E:cisco.3.6.13.1.4.1=1 31.1.1.1.1.25="Se2/0:0"
E:cisco.3.6.13.1.3.2=1 E:cisco.3.6.13.1.4.2=1 31.1.1.1.1.26="Se2/0:1"
E:cisco.3.6.13.1.3.3=0 E:cisco.3.6.13.1.4.3=2 31.1.1.1.1.27="Se2/0:2"
E:cisco.3.6.13.1.3.4=1 E:cisco.3.6.13.1.4.4=2 31.1.1.1.1.28="Se2/0:3"
E:cisco.3.6.13.1.3.5=2 E:cisco.3.6.13.1.4.5=2 31.1.1.1.1.29="Se2/0:4"
E:cisco.3.6.13.1.3.6=3 E:cisco.3.6.13.1.4.6=2 31.1.1.1.1.30="Se2/0:5"
E:cisco.3.6.13.1.3.7=0 E:cisco.3.6.13.1.4.7=4 31.1.1.1.1.31="Se2/0:6"
E:cisco.3.6.13.1.3.8=1 E:cisco.3.6.13.1.4.8=4 31.1.1.1.1.32="Se2/0:7"
E:cisco.3.6.13.1.3.9=2 E:cisco.3.6.13.1.4.9=4 31.1.1.1.1.33="Se2/0:8"
E:cisco.3.6.13.1.3.10=3 E:cisco.3.6.13.1.4.10=4 31.1.1.1.1.34="Se2/0:9"
E:cisco.3.6.13.1.3.11=4 E:cisco.3.6.13.1.4.11=4 31.1.1.1.1.35="Se2/0:10"
E:cisco.3.6.13.1.3.12=5 E:cisco.3.6.13.1.4.12=4 31.1.1.1.1.36="Se2/0:11"
E:cisco.3.6.13.1.3.13=6 E:cisco.3.6.13.1.4.13=4 31.1.1.1.1.37="Se2/0:12"
E:cisco.3.6.13.1.3.14=7 E:cisco.3.6.13.1.4.14=4 31.1.1.1.1.38="Se2/0:13"
E:cisco.3.6.13.1.3.15=-1 E:cisco.3.6.13.1.4.15=-1 31.1.1.1.1.39="Se2/0:14"
E:cisco.3.6.13.1.3.16=0 E:cisco.3.6.13.1.4.16=3 31.1.1.1.1.40="Se2/0:15"

16:27:09.096894 eleni1.1112 > eleni2.snmp:  C=eleni GetBulk(31)  N=0 M=16
31.1.1.1.1.40 (DF)
16:27:09.126691 eleni2.snmp > eleni1.1112:  C=eleni GetResponse(416)
31.1.1.1.1.41="Se2/0:16" 31.1.1.1.1.42="Se2/0:17" 31.1.1.1.1.43="Se2/0:18"
31.1.1.1.1.44="Se2/0:19" 31.1.1.1.1.45="Se2/0:20" 31.1.1.1.1.46="Se2/0:21"
31.1.1.1.1.47="Se2/0:22" 31.1.1.1.1.48="Se2/0:23" 31.1.1.1.1.49="Se2/0:24"
31.1.1.1.1.50="Se2/0:25" 31.1.1.1.1.51="Se2/0:26" 31.1.1.1.1.52="Se2/0:27"
31.1.1.1.1.53="Se2/0:28" 31.1.1.1.1.54="Se2/0:29" 31.1.1.1.1.55="Se2/0:30"
31.1.1.1.1.56="Se2/0:15"

16:27:09.127533 eleni1.1112 > eleni2.snmp:  C=eleni GetBulk(31)  N=0 M=16
31.1.1.1.1.56 (DF)
16:27:09.157619 eleni2.snmp > eleni1.1112:  C=eleni GetResponse(406)
31.1.1.1.1.57="Se2/0:0" 31.1.1.1.1.58="Se2/0:1" 31.1.1.1.1.59="Se2/0:2"
31.1.1.1.1.60="Se2/0:3" 31.1.1.1.1.61="Se2/0:4" 31.1.1.1.1.62="Se2/0:5"
31.1.1.1.1.63="Se2/0:6" 31.1.1.1.1.64="Se2/0:7" 31.1.1.1.1.65="Se2/0:8"
31.1.1.1.1.66="Se2/0:9" 31.1.1.1.1.67="Se2/0:10" 31.1.1.1.1.68="Se2/0:11"
31.1.1.1.1.69="Se2/0:12" 31.1.1.1.1.70="Se2/0:13" 31.1.1.1.1.71="Se2/0:14"
31.1.1.1.1.72="Se2/0:16"

[... stuff deleted]



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
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

Reply via email to