Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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 = '192.168.1.10'; $OID_CD420 = '1.3.6.1.4.1.6889.2.8.1.14.1.1.3.1'; 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; }

Comment on Problems with Net::SNMP
Download Code
Re: Problems with Net::SNMP
by NetWallah (Abbot) 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 snmpwalk.pl, as indicated in this stackoverflow solution.

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-10-21 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (98 votes), past polls