http://qs321.pair.com?node_id=969885

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; }

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 snmpwalk.pl, as indicated in this stackoverflow solution.

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