Menu

#2715 translateObj has trouble translating textual leaf identifiers

perl
open
nobody
5
2016-06-06
2016-06-06
No

SNMP::translateObj has trouble translating textual leaf identifiers

guru> snmptranslate -On -IR rPDULoadPhaseConfigAlarm.phase1
.1.3.6.1.4.1.318.1.1.12.2.2.1.1.5.1
guru>

guru> cat test.pl
'#' /opt/local/bin/perl
use strict;
use warnings;
use feature 'say';
use SNMP;

SNMP::initMib();
SNMP::addMibDirs('/opt/local/share/snmp/mibs/APC');
SNMP::loadModules('PowerNet-MIB');
say 'sysDescr.0 = ', SNMP::translateObj('sysDescr.0');
say 'upsBasicIdentModel.0 = ', SNMP::translateObj('upsBasicIdentModel.0');
say 'rPDULoadPhaseConfigAlarm = ', SNMP::translateObj('rPDULoadPhaseConfigAlarm');
say 'rPDULoadPhaseConfigAlarm.phase1 = ', SNMP::translateObj('rPDULoadPhaseConfigAlarm.phase1');

guru> ./test.pl
sysDescr.0 = .1.3.6.1.2.1.1.1.0
upsBasicIdentModel.0 = .1.3.6.1.4.1.318.1.1.1.1.1.1.0
rPDULoadPhaseConfigAlarm = .1.3.6.1.4.1.318.1.1.12.2.2.1.1.5
Use of uninitialized value in say at ./test line 19.
rPDULoadPhaseConfigAlarm.phase1 =
guru>

net-snmp-5.7.3
SNMP.pm,v 6.1 2010/09/10 00:01:22 dtownSNMP.pm,v 6.1 2010/09/10 00:01:22 dtown
perl-5.20.1
Linux {...} 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Interestingly, the problem is intermittent -- I have code which sometimes succeeds at this. Curiously, sometimes the code succeeds at translating the Object Value into an OID ... but the resulting OID is incorrect. [This seen in 'snmp_get', rather than in a direct 'translateObj'.]

1 Attachments

Discussion


Log in to post a comment.