0
我必須檢查snmp v3是否可用於通過snmp4j管理的設備。如果沒有,我必須使用snmp v2c。但是,如何通過snmp4j檢查可用性?有沒有完成的方法或標準的做法?如何檢查snmp v3是否可用於snmp4j
我認爲是這樣的:
private Target getTarget()
{
Address targetAddress = GenericAddress.parse(ip);
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString(community));
target.setAddress(targetAddress);
target.setRetries(2);
target.setTimeout(1000);
//Check here (with if)
if(snmpv3_is_available)
target.setVersion(SnmpConstants.version3);
else
target.setVersion(SnmpConstants.version2c);
return target;
}
希望有人知道答案!