Why did SNMP4J return different result with Net-SNMP?

150 Views Asked by At

I find that with Net-SNMP, I can get the normal ifPhysAddress result .But when I use SNMP4J,I get some wrong result.How to fix it ? The Net-SNMP result: enter image description here The snmp4j result: enter image description here

1

There are 1 best solutions below

1
Lex Li On

That's absolutely normal.

NET-SNMP ships with a set of default MIB documents, so when it makes SNMP operations derived data types (like PhysAddress for ifPhysAddress) can be interpreted more accurately according to the MIB documents.

However, when you consume the raw SNMP4J library, MIB documents are not involved and the only way is to print out ifPhysAddress as the base type of OCTET STRING which is effectively raw bytes and garble characters.

If you like to achieve the same output like NET-SNMP, you can buy SNMP4J's MIB library or search for other alternative ways.