获取值属性 MIB-Table snmp
Get value attribute MIB-Table snmp
如何获取java中MIB-table的所有值?是否存在 api 来执行此操作?我正在构建一个管理器来获取路由器计数器以估计性能。
你可以使用snmp4j-framework
代码示例:
final Address targetAddress = GenericAddress.parse("X.X.X.X/80");
final TransportMapping transport = new DefaultUdpTransportMapping();
final Snmp snmp = new Snmp(transport);
snmp.listen();
final CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setRetries(80);
target.setTimeout(1500);
target.setVersion(SnmpConstants.version2c);
final PDUFactory pduFactory = new DefaultPDUFactory(PDU.GETBULK);
final TableUtils utils = new TableUtils(snmp, pduFactory);
return utils.getTable(target, new OID[]{ query }, null, null);
如何获取java中MIB-table的所有值?是否存在 api 来执行此操作?我正在构建一个管理器来获取路由器计数器以估计性能。
你可以使用snmp4j-framework
代码示例:
final Address targetAddress = GenericAddress.parse("X.X.X.X/80");
final TransportMapping transport = new DefaultUdpTransportMapping();
final Snmp snmp = new Snmp(transport);
snmp.listen();
final CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setRetries(80);
target.setTimeout(1500);
target.setVersion(SnmpConstants.version2c);
final PDUFactory pduFactory = new DefaultPDUFactory(PDU.GETBULK);
final TableUtils utils = new TableUtils(snmp, pduFactory);
return utils.getTable(target, new OID[]{ query }, null, null);