I enabled Snmptrap on Windows and I got trap messages from remote devices. Following describes result.
2016-10-25 10:19:02 <UNKNOWN> [UDP: [172.16.11.250]:62451->[0.0.0.0]:0]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (287374) 0:47:53.74 SNMPv2-MIB::snmpTrapOID.0 = OID: IF-MIB::linkDown IF-MIB::ifIndex.116 = INTEGER: 116
IF-MIB::ifAdminStatus.116 = INTEGER: up(1) IF-MIB::ifOperStatus.116 = INTEGER: down(2) IF-MIB::ifName.116 = STRING: ge-1/0/1
I also got trap message via snmp4j. Following is my code and result.
Vector<VariableBinding> vbVect = event.getPDU().getVariableBindings();
for (VariableBinding vb : vbVect) {
System.out.println(vb.getOid() + " = " + vb.getVariable());
}
result
1.3.6.1.2.1.1.3.0 = 1:27:14.38
1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.6.3.1.1.5.3
1.3.6.1.2.1.2.2.1.1.116 = 116
1.3.6.1.2.1.2.2.1.7.116 = 1
1.3.6.1.2.1.2.2.1.8.116 = 2
1.3.6.1.2.1.31.1.1.1.1.116 = ge-1/0/1
My question is how can I get trap message after mib parse, just like output on windows?
There are many trap oid on my devices. Should I put them on a file and and parse oid via this file? Or Should I load mibs through snmp4j?
Is there any method can do this? What`s the best practice for this problem?
Thanks in advance!