Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^4: How to encode snmpv2 trap varbind

by ahm123 (Initiate)
on Feb 27, 2013 at 13:09 UTC ( #1020883=note: print w/ replies, xml ) Need Help??

in reply to Re^3: How to encode snmpv2 trap varbind
in thread How to encode snmpv2 trap varbind

Thanks topher ...I will include snmpTrapAddress also in the varbind and test. I will post my test results ..

Comment on Re^4: How to encode snmpv2 trap varbind
Replies are listed 'Best First'.
Re^5: How to encode snmpv2 trap varbind
by ahm123 (Initiate) on Feb 28, 2013 at 10:00 UTC

    Hi topher,

    Thanks a ton for this info !!! Its like a life saver for me ...
    I have included snmpTrapAddress.0 in the trap varbind. Now trap is correctly received and processed by NMS

    use lib '/opt/perl_64/lib/site_perl/5.8.8/';
    use strict;
    use warnings;
    use Net::SNMP qw(:ALL);
    my $curr_time = (scalar time);
    my ($session, $error) = Net::SNMP->session(
    -hostname => '',
    -port => '5286',
    -localaddr => '',
    -localport => '1028',
    -version => 'snmpv2c',
    -community => 'PUBLIC',
    if (!defined($session)) {
    printf("ERROR: %s.\n", $error);
    exit 1;

    my $result = $session->snmpv2_trap(
    -varbindlist => [
    '', TIMETICKS, 600,
    '', IPADDRESS, '', '', INTEGER32, 11,
    '', COUNTER32, 10,
    '', TIMETICKS, $curr_time,
    '', INTEGER32, 2,
    '', OCTET_STRING, '' ]

    if (!defined($result)) {
    printf("ERROR: %s.\n", $session->error());
    else {
    printf("SNMPv2-Trap-PDU sent.\n");


      Excellent. Good to hear that solved the problem for you.

      Christopher Cashell

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020883]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2015-12-01 06:57 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (795 votes), past polls