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

Hi,

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

COMMAND-LINE:

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

uluc04% snmptranslate -m all -IR sysObjectID.0
.1.3.6.1.2.1.1.2.0

uluc04% snmptranslate -m all -On .1.3.6.1.2.1.1.2.0
system.sysObjectID.0

uluc04% snmptranslate -m all -IR enterprises.cisco.workgroup.wsc4006sysID
.1.3.6.1.4.1.9.5.46

uluc04% snmptranslate -m all -On .1.3.6.1.4.1.9.5.46
enterprises.cisco.workgroup.wsc4006sysID

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

PERL CODE:
[The code for "test" is attached below.]

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

obj = sysObjectID.0
val = .1.3.6.1.4.1.9.5.46
string = enterprises.
uluc04%

Comments:
I don't understand why an '&snmp_get("sysObjectID.0")' gives me an OID
(.1.3.6.1.4.1.9.5.46) rather than the string
'enterprises.cisco.workgroup.wsc4006sysID'.

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

Any insights appreciated.

--sk

Stuart Kendrick
FHCRC

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