Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Problems with Net::SNMP

by fercoen (Initiate)
on May 11, 2012 at 00:21 UTC ( #969885=perlquestion: print w/replies, xml ) Need Help??

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

Hi everyone! I'm a total noob on Perl and I have a problem... I'm trying to get a script working with Net::SNMP but I always get the error: "Received noSuchName(2) error-status at error-index 1."

Can anybody help me? Here's my script:

use Net::SNMP; $host = ''; $OID_CD420 = ''; my ($session, $error) = Net::SNMP->session(-hostname => $host, -commu +nity => 'public', -translate => 0,); if (!defined $session) { print "SNMP:\t$error\n"; exit(2); } else { printOID($session, $OID_CD420, 'Descripcion: ') } $session->close(); exit(0); sub printOID { my ($ses, $oid, $text) = (@_); my $aux = ''; my $res = $ses->get_request(-varbindlist => [ $oid ],); if (!defined $res) { printf "ERROR: %s.\n", $ses->error(); } else { $aux = $res->{$oid}; print $text.$aux."\n"; } return $aux; }

Replies are listed 'Best First'.
Re: Problems with Net::SNMP
by NetWallah (Canon) on May 11, 2012 at 00:33 UTC
    That means that the specified SNMP object was not found.

    Try adding a ".0" at the end of the OID.

    Also verify the credentials, and that the MIB was loaded at the target.
    If that fails, try, as indicated in this stackoverflow solution.

                 I hope life isn't a big joke, because I don't get it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://969885]
Approved by toolic
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-08-15 14:55 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (79 votes). Check out past polls.