[SNMP4J] Print all In new window [SMI-1.2.0]Translating OID to human readable string
Raymond Yan Lok Chan
lok77chan at gmail.com
Thu May 12 08:25:55 CEST 2016
Hi all,
I am currently trying to use SMI-1.2.0 API to translate an OID using the
following guide:
https://oosnmp.net/confluence/pages/viewpage.action?pageId=5799973
and come up with the following code:
static {
try{
SmiManager smiManager = new SmiManager(null, new
File("E:/Download/snmp4j-smi-1.2.0-dist/snmp4j-smi-1.2.0/mibrepository"));
smiManager.loadModule("SNMP-VIEW-BASED-ACM-MIB");
smiManager.loadModule("SNMPv2-MIB");
SNMP4JSettings.setOIDTextFormat(smiManager);
SNMP4JSettings.setVariableTextFormat(smiManager);
} catch (IOException e){
System.out.println(e);
}
}
public static void main(String[] args) {
OID testPrivOID = new OID("1.3.6.1.4.1.4976");
System.out.println(testPrivOID.toString());
}
According to the guide, I expected to see output "enterprises.4976", but
instead I am only getting "1.3.6.1.4.1.4976".
Just for a confirmation, I tried to put everything in the main and checked
if the smiManager loaded the required Mibs:
public static void main(String[] args) throws {
SmiManager smiManager = new SmiManager(null, new
File("E:/Download/snmp4j-smi-1.2.0-dist/snmp4j-smi-1.2.0/mibrepository"));
smiManager.loadModule("SNMP-VIEW-BASED-ACM-MIB");
smiManager.loadModule("SNMPv2-MIB");
SNMP4JSettings.setOIDTextFormat(smiManager);
SNMP4JSettings.setVariableTextFormat(smiManager);
for(String module: smiManager.getLoadedModuleNames()){
System.out.print(module+' ');
}
OID testPrivOID = new OID("1.3.6.1.4.1.4976");
System.out.println(testPrivOID.toString());
}
and give me the following:
SNMP-VIEW-BASED-ACM-MIB SNMPv2-MIB 1.3.6.1.4.1.4976
Can anyone point out what I have done wrongly please? Or even tell me if
the translation is a PRO only feature.
Thank you all in advance.
Best,
*Raymond Chan*
More information about the SNMP4J
mailing list