Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Net::SNMP ASN1 Type error

by kcott (Archbishop)
on Oct 11, 2010 at 20:02 UTC ( [id://864686]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^4: Net::SNMP ASN1 Type error
by jbumsted (Initiate) on Oct 11, 2010 at 20:16 UTC

    Ok, I have changed the code to this:

    use strict; use warnings; use Net::SNMP; my $ip = XXX.XXX.XXX.XXX; 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();

    When I run that I get the following error: Bareword "INTEGER" not allowed while "strict subs" in use at line 19. If I put quotes around INTEGER, I get the original error of ASN.1 Type Integer unknown.

      Mismatched quotes:

      '1.3.6.1.4.1.6080.3.1.2.4.0"

      Should be:

      '1.3.6.1.4.1.6080.3.1.2.4.0'

      -- Ken

      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

        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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-26 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found