SNMP PERL module / command-line output differ 
Author Message
 SNMP PERL module / command-line output differ


The output delivered by an "&snmp_get" differs from the output delivered
by "/opt/local/bin/snmpget" ... and I'm wondering why.

I'm trying to retrieve "system.sysObjectID.0" ... works from the
command-line, gives me behavior which I don't understand from within PERL.

ucd-snmp v4.2.3, PERL v5.005_03, Solaris 2.7


uluc04% snmpget -m all -c public d5-esx sysObjectID.0
system.sysObjectID.0 = OID:

uluc04% snmptranslate -m all -IR sysObjectID.0

uluc04% snmptranslate -m all -On .

uluc04% snmptranslate -m all -IR

uluc04% snmptranslate -m all -On .

I don't understand why an 'snmptranslate' of
'' gives me '.'
instead of '.'.  If you have any insights, please let me
know.  But at least the end-result is what I would expect.

[The code for "test" is attached below.]

uluc04% ./test
oid = .
leaf = sysObjectID.0

obj = sysObjectID.0
val = .
string = enterprises.

I don't understand why an '&snmp_get("sysObjectID.0")' gives me an OID
(. rather than the string

Nor do I understand why the &SNMP::translateObj('.')
command returns only 'enterprises.', rather than the string which the
command-line version returns, i.e.

Any insights appreciated.


Stuart Kendrick

Where "test" looks as follows:

#!/opt/local/bin/perl -w

use strict;
use SNMP;

my ($leaf, $obj, $oid, $sess, $string, $val);
$obj = "sysObjectID.0";

$sess = new SNMP::Session       (       Version =>      "2",
                                        DestHost =>     "d5-esx",
                                        Community =>    "public"

$oid = &SNMP::translateObj($obj);
$leaf = &SNMP::translateObj($oid);
print "oid = $oid\n";
print "leaf = $leaf\n\n";

$val = $sess->get($obj);
if ($sess->{ErrorStr}) { print "error = $sess->{ErrorStr}\n" }

$string = &SNMP::translateObj($val);

print "obj = $obj\n";
print "val = $val\n";
print "string = $string\n";

Sat, 19 Jun 2004 04:53:39 GMT  
 [ 1 post ] 

 Relevant Pages 

1. capturing command line error or output from `<command>`

2. Output of a command line command

3. SNMPCLI - SNMP Command Line Interface

4. SNMP table walking with SNMP PERL module?

5. SNMP module (SNMP Perl) ?

6. Differing output for $ARGV[0] ?!?!?

7. Telnet module and perl script to telnet to remote, perform commands and log output

8. novice question: how import many lines of command output

9. Command line options Input >Output how?

10. command-line output re-direction in winNT

11. Unicode output in Command Line


Powered by phpBB® Forum Software