1

トラップの重大度を設定するにはどうすればよいですか?

以下のコード

TransportMapping transport = new DefaultUdpTransportMapping();
    Snmp snmp = new Snmp(transport);

    CommunityTarget localtarget = new CommunityTarget();
    localtarget.setCommunity(new OctetString("public"));
    localtarget.setAddress(new UdpAddress(managerIpAdd + "/162"));
    localtarget.setVersion(SnmpConstants.version2c);
    localtarget.setRetries(3);
    localtarget.setTimeout(2000);

    PDU pdu = new PDU();

    // need to specify the system up time
    pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new OctetString(new Date().toString())));
    pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, targetOID));
    pdu.add(new VariableBinding(SnmpConstants.snmpTrapAddress, new IpAddress(ApplicationUtil.getMachineIpAddress())));

    // variable binding for Enterprise Specific objects, Severity (should be defined in MIB file)
    pdu.add(new VariableBinding(targetOID, new OctetString(message)));        

    pdu.setType(PDU.TRAP);

    snmp.send(pdu, localtarget);

    snmp.close();

ありがとう、

4

1 に答える 1

3

トラップの重大度を指定する標準的な方法はありません。「アラーム」トラップを送信するほとんどのエージェントは、重大度のvarbindを含む独自のMIBを定義します。

于 2010-08-12T00:41:13.653 に答える