problem with NetSNMP::OID

<[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello all,

I'm currently modifying our application to use the embedded Perl
module with net-snmp v5.4.2.1 and stumbled upon a problem with
NetSNMP::OID. The problem is very easy to reproduce by adding just two
lines to the code snippet taken from the NetSNMP::TrapReceiver
documentation:

  #!/usr/bin/perl

  use NetSNMP::OID; # FIRST LINE ADDED

  sub my_receiver {
    print "********** PERL RECEIVED A NOTIFICATION:\n";

    # print the PDU info (a hash reference)
    print "PDU INFO:\n";
    foreach my $k(keys(%{$_[0]})) {
      printf "  %-30s %s\n", $k, $_[0]{$k};
    }

    # print the variable bindings:
    print "VARBINDS:\n";
    foreach my $x (@{$_[1]}) {
        printf "  %-30s type=%-2d value=%s\n", $x->[0], $x->[2],
$x->[1];
    }

    my $oid = new NetSNMP::OID('sysContact.0'); # SECOND LINE ADDED
  }

  NetSNMP::TrapReceiver::register("all", \&my_receiver) ||
    warn "failed to register our perl trap handler\n";

  print STDERR "Loaded the example perl snmptrapd handler\n";

Now if I configure snmptrapd to use this piece of code and generate a
trap using

  > snmpinform -v 3 -l $LEVEL -u $USER -a MD5 -A $PASS -x DES \
  -X $PASS $IPADDRESS '' QUANTE-CSS-MIB-V2::rmTrapDownloadCancel \
  QUANTE-CSS-MIB-V2::eventCurrentNumber.0 u `date +%s` \
  QUANTE-CSS-MIB-V2::actualIndex.1 i 1

for the first time, I get the following lines in the output

[UDP: [10.25.153.160]->[10.25.153.160]:35238]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (269834978) 31 days,
5:32:29.78    SNMPv2-MIB::snmpTrapOID.0 = OID:
QUANTE-CSS-MIB-V2::rmTrapDownloadCancel
QUANTE-CSS-MIB-V2::eventCurrentNumber.0 = Gauge32: 1237823308
QUANTE-CSS-MIB-V2::actualIndex.1 = INTEGER: 1
******** PERL RECEIVED A NOTIFICATION:
<snip>
VARBINDS:
DISMAN-EVENT-MIB::sysUpTimeInstance type=67 value=Timeticks: (269834978)
31 days, 5:32:29.78
SNMPv2-MIB::snmpTrapOID.0      type=6  value=OID:
QUANTE-CSS-MIB-V2::rmTrapDownloadCancel
QUANTE-CSS-MIB-V2::eventCurrentNumber.0 type=66 value=Gauge32:
1237823308
QUANTE-CSS-MIB-V2::actualIndex.1 type=2  value=INTEGER: 1


This looks fine, but when I call the command above a second time,
output changes in the following way:

[UDP: [10.25.153.160]->[10.25.153.160]:35238]:
sysUpTimeInstance 31:5:32:33.36 snmpTrapOID.0 rmTrapDownloadCancel
eventCurrentNumber.0 1237823311      actualIndex.1 1
********** PERL RECEIVED A NOTIFICATION:
<snip>
VARBINDS:
  sysUpTimeInstance              type=67 value=31:5:32:33.36
  snmpTrapOID.0                  type=6  value=rmTrapDownloadCancel
  eventCurrentNumber.0           type=66 value=1237823311
  actualIndex.1                  type=2  value=1

How can I avoid to get a different output formatting?

Regards,
Jens


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
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.