Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: SNMP problems

by andyford (Curate)
on Sep 11, 2007 at 20:40 UTC ( #638427=note: print w/replies, xml ) Need Help??

in reply to SNMP problems

Can you show all your code or at least a working subset? I am having trouble duplicating your results: I get the same empty result set with the mac table or ifTable and I never get the error message.

non-Perl: Andy Ford

Replies are listed 'Best First'.
Re^2: SNMP problems
by ribasushi (Monk) on Sep 11, 2007 at 22:05 UTC
    Here is my complete test script:
    #!/usr/bin/perl use warnings; use strict; use SNMP; use Data::Dumper; $Data::Dumper::Useqq = 1; my $switchaddr = '<SET_ME>'; my $community = '<SET_ME>'; my $snmp = SNMP::Session->new ( DestHost => $switchaddr, Community => $community, Version => '2c', ) or die "Unable to connect to $switchaddr\n"; for my $oid (qw/ . . /) { print "\nTrying snmpwalk on $oid\n=========================\n"; print scalar `snmpwalk -O n -v 2c -c $community $switchaddr $oid`; print "\nTrying SNMP->gettable on $oid\n=========================\ +n"; my $response; eval { $response = $snmp->gettable ($oid) }; if ($@) { print "FAILED: $@\n"; } else { print Dumper $response; } }

    and here is the result.

      Wow, ran your code and still got no results from gettable() for either OID but my snmpwalk results look great. I'm using perl 5.8.5 and SNMP 5.1.2 on Linux. How 'bout you?

      Update: fixed version and module name

      non-Perl: Andy Ford

Re^2: SNMP problems
by ribasushi (Monk) on Sep 11, 2007 at 22:11 UTC
    On reading my original posting I realized that I omitted a leading '.' when pasting things around. Sorry about that.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://638427]
[holli]: Oh, seems like LanX' team has won the fourth World Cup ... awesome!
LanX grins
[marto]: anyway, don't come to Glasgow for the football :)
[holli]: the hell? i have a scriptblocker on.
[holli]: how do you update a different window without javascript?
[holli]: ah, chatterbox right
[marto]: it's a normal HTML form, with some hidden input fields
[holli]: forgot that thing exists for a moment.
LanX welcome to the twilight zone ...
[Eily]: LanX well since the onion is your eye you should see it everywhere

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2017-12-14 16:14 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (398 votes). Check out past polls.