fix:主备切换测试
This commit is contained in:
@@ -9,6 +9,7 @@ import org.snmp4j.smi.*;
|
||||
import org.snmp4j.transport.DefaultUdpTransportMapping;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
@@ -79,8 +80,14 @@ public class SnmpTrapSender implements AutoCloseable{
|
||||
new TimeTicks(System.currentTimeMillis()/1000)));
|
||||
pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID,
|
||||
new OID(enterpriseOid + ".1.1")));
|
||||
byte[] msg = new byte[10];
|
||||
try {
|
||||
msg = message.getBytes("GBK");
|
||||
} catch (Exception e) {
|
||||
System.out.println("编码错误");
|
||||
}
|
||||
pdu.add(new VariableBinding(new OID(enterpriseOid + ".2.1"),
|
||||
new OctetString(message)));
|
||||
new OctetString(msg)));
|
||||
pdu.add(new VariableBinding(new OID(enterpriseOid + ".2.2"),
|
||||
new Integer32(severity)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user