如何使用私有mib获取snmptrap v2的响应

时间:2018-06-06 06:09:46

标签: java snmp net-snmp snmp4j snmp-trap

私人mib的定义如下:

1.3.6.1.4.1.49763.1.2.5
userTrap NOTIFICATION-TYPE 
OBJECTS{
userName,
userType,
userStatus
}
STATUS current
DESCRIPTION
"Traps of user operation"
::={stationTrap 2}

我的代码受SNMP4J支持,如下所示

public void processPdu(CommandResponderEvent CREvent) {  
        if (CREvent != null && CREvent.getPDU() != null) {
           try {  
            Vector<? extends VariableBinding> recVBs = 
            CREvent.getPDU().getVariableBindings();
              for (int i = 0; i < recVBs.size(); i++) {
                    VariableBinding recVB = recVBs.elementAt(i);
                    System.out.println(recVB.getOid() + " : " + 
            recVB.getVariable());                   
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        }
    }

我想知道这个陷阱的响应类型是什么,如何在OBJECTS中获取userName和userType

0 个答案:

没有答案