1

私有 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

4

0 回答 0