The session is using SNMPv1. I tried changing OCTET_STRING to 0x01 and it ended in the same result.
Unknown ASN.1 type [0x01]
I am including the full code so anyone can take a look at what is going on:
use strict; use Net::SNMP qw(:snmp); my ($session, $error) = Net::SNMP->session( -hostname => shift || '$ +host', -community => 'public', -version => 'snmpv1', -port => shift || 16 +2 ); if (!defined($session)) { printf("ERROR: %s.\n", $error); exit 1; } my $svSvcName = '1.3.6.1.4.1.77.1.2.3.1.1'; my $message = "THIS IS AN SNMP TEST"; my @oids = ($svSvcName, "OCTET_STRING", $message); #my @oids; my $result = $session->trap( -agentaddr => '$monitor', -varbindlist => \@oids #-varbindlist => [$svSvcName, OCTET_STRIN +G, "$message"] ); if (!defined($result)) { printf("ERROR: %s.\n", $session->error); $session->close; exit 1; } $session->close;
Also I don't know if this is of importance but the script is running on a Windows 2000 machine with perl 5.8

In reply to Re: Re: Send SNMP trap by tertullian01
in thread Send SNMP trap by tertullian01

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.