Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: Net::SNMP ASN1 Type error

by kcott (Archbishop)
on Oct 12, 2010 at 10:56 UTC ( [id://864801]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Net::SNMP ASN1 Type error
in thread Net::SNMP ASN1 Type error

Your problem was niggling me so I tried it myself.

Other than the $ip value, I used exactly what you have (with the mismatched quote problem fixed).

Here's my code:

#!perl use strict; use warnings; use Net::SNMP; my $ip = '127.0.0.1'; my $SESSION = Net::SNMP->session (-hostname=>$ip, -community=>"private +"); $SESSION->set_request(-varbindlist=> ['1.3.6.1.4.1.6080.3.1.2.4.0', IN +TEGER, 1]); print $SESSION->error();

And here's the output:

$ net_snmp_problem.pl No response from remote host "127.0.0.1"

As you can see, no problem with INTEGER.

Furthermore, when I ran it without fixing the quotes, I got:

Can't find string terminator "'" anywhere before EOF at ./net_snmp_pro +blem.pl line 12.

which suggests that you're posting different code to what you're actually running.

Anyway, if you're still having difficulties, my best advice would be to re-install Net::SNMP.

-- Ken

Replies are listed 'Best First'.
Re^6: Net::SNMP ASN1 Type error
by jbumsted (Initiate) on Oct 12, 2010 at 13:59 UTC

    Thanks for your help Ken. I neglected to mention that this is running on ActiveState Perl. I copied my code and ran it on OSX in a shell and had no issues with the INTEGER constant. I re-installed the Net::SNMP module on my Activestate Windows box, but still get the same error. In this case, probably not a huge deal, I'll do a work around by using the system command to run snmpset in a dos prompt. I just hate doing that, seems slower and more clunky. Thanks again.

      I also have Activestate (v5.10.1) on Windows XP and the above code from Ken works fine for me - no issue with bareword INTEGER.

      What version of Net::SNMP are you using - I'm at v6.0.0. I've seen this error in the past with older versions of Net::SNMP, the fix was as described above in the 'use' line:

      use Net::SNMP qw(:asn1 :snmp);

      I have a Windows box but I'm running Strawberry Perl. Worked fine here too:

      C:\_\tmp>net_snmp_problem.pl No response from remote host "127.0.0.1" C:\_\tmp>

      The earlier output was from Cygwin.

      I've got Perl 5.12.0 on both and Net::SNMP 6.0.1 on both. I didn't have Net::SNMP running on either so they're both fresh installs and the latest version.

      And, unfortunately, that's me completely out of ideas.

      -- Ken

        I am using Net::SNMP 6.0.1 on Activestate 5.12.1. I'm not sure what is going on, perhaps I will reinstall everything. I added the qw's to the use line to no avail. Thanks again for all of your help.

      I was able to get this to work by using the asn.1 value for INTEGER (2) and OCTET_STRING (4).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found