[SNMP4J] Print all In new window [SMI-1.2.0]Translating OID to human readable string
Frank Fock
fock at agentpp.com
Fri May 13 01:11:44 CEST 2016
Hi Raymond,
There is a typo in the FAQ description. Please load the MIB module
"SNMPv2-SMI" instead of "SNMPv2-MIB". Then it works.
Best regards,
Frank
Am 12.05.2016 um 08:25 schrieb Raymond Yan Lok Chan:
> 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*
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j
--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax: +49 7024 8688231
More information about the SNMP4J
mailing list