Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Net::SNMP ASN1 Type error

by jbumsted (Initiate)
on Oct 11, 2010 at 19:11 UTC ( [id://864677]=perlquestion: print w/replies, xml ) Need Help??

jbumsted has asked for the wisdom of the Perl Monks concerning the following question:

Hi -

I am attempting to script the setting of an OID through Net::SNMP. I have determined that the session is getting created successfully, I can do read_requests successfully, etc. The error I see when checking $SESSION->error() is: "The ASN.1 type "INTEGER" is unknown. " Here is my code:

use Net::SNMP; my $SESSION = Net::SNMP->session (-hostname => $ip, -community =>priva +te); $SESSION->set_request(-varbindlist=>["1.3.6.1.4.1.6080.3.1.2.4.0", INT +EGER, 1]); print $SESSION->error();

Any help would be greatly appreciated. Thanks! NOTE: Edited for spelling. , and edited to "fix my mess".

Replies are listed 'Best First'.
Re: Net::SNMP ASN1 Type error
by kcott (Archbishop) on Oct 11, 2010 at 19:33 UTC

    Please put <code>...</code> tags around your code (see Writeup Formatting Tips) - this is very hard to read. (code tags added as requested)

    Can you show your use Net::SNMP line. You may have blocked INTEGER from being exported.

    Also, private in -community =>private should be quoted.

    -- Ken

      Thanks for the response Ken. I updated the original post to make it more readable. My use line is below.

      use Net::SNMP;

        That line looks fine. INTEGER should be exported by default. Please do the following:

        Add:

        use strict; use warnings;

        before that line.

        Quote the bareword private.

        Run it again and post any error output.

        -- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://864677]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found