...
If you use SNMP4J-SMI-PRO in your agent/application, you can even get more formatting, because then also DISPLAY-HINT information of the MIB can be used to format the index values (for SNMP4J-SMI-PRO initialisation see "How to use the extended features SNMP4J-SMI-PRO provides?"):
Code Block | ||
---|---|---|
| ||
SmiManager smiManager = new SmiManager(...); // Register SNMP4J-SMI-PRO to SNMP4J(-Agent): SNMP4JSettings.setOIDTextFormat(smiManager); SNMP4JSettings.setVariableTextFormat(smiManager); smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex4RoundTrip); // load SNMP-VIEW-BASED-ACM-MIB (needs to be compiled from SMIv2 source before, see link above) smiManager.loadModule("SNMP-VIEW-BASED-ACM-MIB"); OID vacmViewTreeFamilyEntryOID = new OID(new int[]{1, 3, 6, 1, 6, 3, 16, 1, 5, 2, 1}); OID vacmViewTreeFamilyMaskColumnOID = new OID("3"); OID vacmViewTreeFamilyRowIndex= new OID("22.117.110.114.101.115.116.114.105.99.116.101.100.39.46.82.101.97.100.86.105.101.119.3.1.3.6"); OID vacmViewTreeFamilyMaskInstanceOID = vacmViewTreeFamilyEntryOID.append(vacmViewTreeFamilyMaskColumnOID).append(vacmViewTreeFamilyRowIndex); System.out.println("> "+vacmViewTreeFamilyMaskInstanceOID); > vacmViewTreeFamilyMask."'unrestricted\'.ReadView'.'dod' OID vacmAccessContextMatch = new OID("1.3.6."dod"1.6.3.16.1.4.1.4.7.118.51.103.114.111.117.112.0.3.1"); > vacmAccessContextMatch."v3group"."".3.'noAuthNoPriv(1)' |