[SNMP4J] Synchronous v1 GET not getting the result
Deon van der Merwe
dvdm at truteq.co.za
Tue Jan 11 19:41:47 CET 2005
Hi Frank,
Thanks! That was spot on.
Do you guess LOTTO numbers this accurate as well?
;-)
Frank Fock wrote:
> Hi Deon,
>
> I guess that you have forgotten to call Snmp.listen(), right?
>
> Best regards,
> Frank
>
>
> Deon van der Merwe wrote:
>
>> Hi,
>>
>> I am sending a SNMP v1 GET command to a cisco router. On tcpdump
>> I see the request go out and the response coming back. But I do
>> not get the actual response PDU.
>>
>> Here is (more or less) my code. It is in the second to last line
>> that I always get a "null".
>>
>> mCommunityTarget.setCommunity(new
>> org.snmp4j.smi.OctetString(mCommunityName));
>> mCommunityTarget.setAddress(new
>> org.snmp4j.smi.UdpAddress(java.net.InetAddress.getByName(mAddress),
>> mPort));
>> mCommunityTarget.setRetries(1);
>> mCommunityTarget.setTimeout(4096);
>> mCommunityTarget.setVersion(org.snmp4j.mp.SnmpConstants.version1);
>>
>> org.snmp4j.Snmp vSnmp = new org.snmp4j.Snmp(new
>> org.snmp4j.transport.DefaultUdpTransportMapping());
>>
>> for (int i = 0; i < mVariableLookup.size(); ++i) {
>> OID vOIDHolder = (OID) mVariableLookup.get(i);
>> org.snmp4j.PDU vPDU = new org.snmp4j.PDU();
>> vPDU.add(new org.snmp4j.smi.VariableBinding(new
>> org.snmp4j.smi.OID(vOIDHolder.mObjectID)));
>> vPDU.setType(org.snmp4j.PDU.GET);
>> mLogger.debug("snd: " + vPDU);
>> org.snmp4j.PDU vResponsePDU = vSnmp.sendPDU(vPDU,
>> mCommunityTarget);
>> mLogger.debug("rcv: " + vResponsePDU);
>> }
>>
>> Here is a log:
>> ---------------------------------
>> 2005-01-11 17:03:59,759 Thread-com.truteq.counter.HostResources DEBUG
>> root - snd: GET[reqestID=0, errorStatus=0, errorIndex=0,
>> VBS[1.3.6.1.2.1.2.2.1.16.4 = Null]]
>> 2005-01-11 17:03:59,760 Thread-com.truteq.counter.HostResources DEBUG
>> org.snmp4j.transport.DefaultUdpTransportMapping - Sending message to
>> 196.26.229.249/161 with length 44: 30:2a:02:
>> 01:00:04:05:74:74:63:6f:6d:a0:1e:02:04:49:f4:4d:ba:02:01:00:02:01:00:30:10:30:0e:06:0a:2b:06:01:02:01:02:02:01:10:04:05:00
>>
>> 2005-01-11 17:03:59,760 Thread-com.truteq.counter.HostResources DEBUG
>> org.snmp4j.Snmp - New pending request with
>> handleorg.snmp4j.mp.PduHandle at 49f44dba
>> 2005-01-11 17:04:03,869 Timer-3 DEBUG
>> org.snmp4j.transport.DefaultUdpTransportMapping - Sending message to
>> 196.26.229.249/161 with length 44:
>> 30:2a:02:01:00:04:05:74:74:63:6f:6d:a0:1e
>> :02:04:49:f4:4d:ba:02:01:00:02:01:00:30:10:30:0e:06:0a:2b:06:01:02:01:02:02:01:10:04:05:00
>>
>> 2005-01-11 17:04:03,869 Timer-3 DEBUG org.snmp4j.Snmp - running
>> pending request with handleorg.snmp4j.mp.PduHandle at 49f44dba
>> 2005-01-11 17:04:07,979 Thread-com.truteq.counter.HostResources DEBUG
>> root - rcv: null
>>
>> -Deon
>> _____________________________________________________
>> TruTeq Wireless (Pty) Ltd. | Tel: +27 (0)12 667 1530
>> http://www.truteq.co.za | Fax: +27 (0)12 667 1531
>> Wireless communications for remote machine management
>>
>> _______________________________________________
>> SNMP4J mailing list
>> SNMP4J at agentpp.org
>> http://p15141779.pureserver.info/mailman/listinfo/snmp4j
>>
>
>
>
More information about the SNMP4J
mailing list