资 源 简 介
简单的连接snmp agent 然后get数据
在main函数中
Address targetAddress=GenericAddress.parse("udp:192.168.5.151/161");
TransportMapping transport=new DefaultUdpTransportMapping();
Snmp snmp=new Snmp(transport);
transport.listen();
CommunityTarget target=new CommunityTarget();
target.setCommunity(new OctetString("WinSpread"));
target.setAddress(targetAddress);
target.setRetries(3);
target.setTimeout(5000);
target.setVersion(1);
PDU request=new PDU();
request.setType(PDU.SET);
// request.add(new VariableBinding(new OID("IP-FORWARD-MIB::inetCidrRouteMetric4.ipv4")));
// request.add(new VariableBinding(new OID("IP-MIB::ipAdEntAddr")));
// request.add(new VariableBinding(new OID(".1.3.6.1.2.1.1.3.0")));
//