[SNMP4J] A question about getTable
Mark Ellison
Mark at EllisonSoftware.com
Wed Aug 13 16:46:01 CEST 2008
Hi,
One thing I notice- you have 'lowerIndex' and 'upperIndex' both set to
null. Try setting lowerIndex to '0' and upperIndex to '256' or some
other large value. Both of these index values can be a single subid.
Regards,
Mark
On 08/12/2008 07:10 PM, Enrique J. Garcia Diaz wrote:
> Hi Frank,
>
> I have increased the timeout and unfortunately, the result is the same. I am
> using net snmp agent, version 5.4.0 (the latest, I think). I have seen the
> same behaviour with ipAddrTable (I do not know if that gives more info).
>
> I can prove with another agent and see if the result is the same. Anybody
> recommend me an agent?
>
> Thanks for the replies.
> Kike
>
> 2008/8/13 Frank Fock <fock at agentpp.com>
>
>
>> Maybe you need to increase the timeout value
>> or check if the agent has a bug regarding
>> lexicographic ordering, which is often
>> the case in conjunction with the tcpConnTable.
>>
>> Also the PDU size might impose a problem here.
>> But that would be also an agent bug.
>>
>> Best regards,
>> Frank
>>
>> Enrique J. Garcia Diaz wrote:
>>
>>
>>> Hi Frank,
>>>
>>> Thank you for your advice. I have tried without a dot at the beginning but
>>> the result is the same. Anyway, i am going to use the standard from now.
>>>
>>> Maybe I make a mistake and the problem is not where I am thinking... I do
>>> not know, do you think that is correct my approach?
>>>
>>> Thnks, BR,
>>> Kike
>>>
>>> 2008/8/13 Frank Fock <fock at agentpp.com <mailto:fock at agentpp.com>>
>>>
>>>
>>> Hi Kike,
>>>
>>> OIDs do not start with a dot! This is some
>>> stupid notation from NET-SNMP which is
>>> non-standard. Try "1.3.6.1.2.1.6.13.1.1"
>>> instead.
>>>
>>>
>>> Best regards,
>>> Frank
>>>
>>> Enrique J. Garcia Diaz wrote:
>>>
>>> Hi Frank,
>>>
>>> I am going to try to explain better my question...
>>>
>>> I have implemented a method that returns a list with the rows of
>>> any table. The method is called getTable and the code is below.
>>>
>>> public List getTable(String[] oid) {
>>> try {
>>> snmp.listen();
>>> }
>>> catch (IOException e) {
>>> e.printStackTrace();
>>> }
>>> TableUtils utils = new TableUtils(snmp, new
>>> DefaultPDUFactory());
>>> OID lowerIndex = null;
>>> OID upperIndex = null;
>>> OID[] arr = new OID[oid.length];
>>> for (int i=0; i<oid.length; i++) arr[i] = new OID(oid[i]);
>>> List list = utils.getTable(target, arr,
>>> lowerIndex, upperIndex);
>>> return list;
>>> }
>>>
>>> The input of this method is an array of String that represents
>>> the OIDs. In the case of the table TcpConnTable (from RFC1213)
>>> the array contains the following values:
>>>
>>> String [] tcpConnTable = { ".1.3.6.1.2.1.6.13.1.1",
>>> ".1.3.6.1.2.1.6.13.1.2", ".1.3.6.1.2.1.6.13.1.3",
>>> ".1.3.6.1.2.1.6.13.1.4", ".1.3.6.1.2.1.6.13.1.5" };
>>>
>>> ".1.3.6.1.2.1.6.13.1.1" belongs to tcpConnState,
>>> ".1.3.6.1.2.1.6.13.1.2" belongs to tcpConnLocalAddress, etc.
>>>
>>> The returned value of this method in the case of TcpConnTable is
>>> not valid (is null) and nullPointerException is thrown.
>>>
>>> I have found some cases that the method returns valid values.
>>> For example if I call the method with the following array of
>>> String:
>>> String [] hrSWRunTable = { ".1.3.6.1.2.1.25.4.2.1.1",
>>> ".1.3.6.1.2.1.25.4.2.1.2", ".1.3.6.1.2.1.25.4.2.1.3",
>>> ".1.3.6.1.2.1.25.4.2.1.4", ".1.3.6.1.2.1.25.4.2.1.5",
>>> ".1.3.6.1.2.1.25.4.2.1.6", ".1.3.6.1.2.1.25.4.2.1.7" }
>>>
>>> where,
>>> ".1.3.6.1.2.1.25.4.2.1.1" belongs to hrSWRunIndex (from
>>> HOST_RESOURCES), ".1.3.6.1.2.1.25.4.2.1.2" belongs to
>>> hrSWRunName, etc.
>>>
>>> So, I think that the problem is that I am not able to call this
>>> method with the correct array of String that belongs of the list
>>> of OIDs of the columns in the table. I have found with a MIB
>>> browser that there is a OIDs like I wrote in my previous mail
>>> (.1.3.6.1.2.1.6.13.1.1.127.0.0.
>>> 1.27015.127.0.0.1.1093).
>>>
>>> Then, I would like to know if I am doing something wrong and how
>>> people retrieve data from a table like TcpConnTable.
>>>
>>> I hope I have explained better with this mail.
>>>
>>> Thanks and BR,
>>> Kike
>>>
>>>
>>> 2008/8/12 Frank Fock <fock at agentpp.com <mailto:fock at agentpp.com>
>>> <mailto:fock at agentpp.com <mailto:fock at agentpp.com>>>
>>>
>>>
>>>
>>> Hello Kike,
>>>
>>> What exactly is the problem?
>>>
>>> Best regards,
>>> Frank
>>>
>>>
>>> Enrique J. Garcia Diaz wrote:
>>>
>>> Hello everybody!
>>>
>>> I have tried to look for an answer first to previous
>>> messages but,
>>> unfortunately I have not found anything that clarify me.
>>> So, I
>>> apologize if
>>> this is not the best place to ask or if someone has asked
>>> before.
>>>
>>> My problem is that I want to make a program that retrieve
>>> SNMP
>>> information.
>>> In particular, I have some problems retrieving information
>>> in
>>> some tables,
>>> in particular, TcpConnTable (RFC1213).
>>>
>>> The problem is that if I use getTable method (in
>>> org.snmp4j.util.TableUtils), I do not receive the data of
>>> the
>>> tables. The
>>> reason is because some OIDs are something like this:
>>> .1.3.6.1.2.1.6.13.1.1.127.0.0.1.27015.127.0.0.1.1093,
>>> where the
>>> last fields
>>> are my IP address and the listened port (info that it is
>>> likely
>>> that I do
>>> not know)
>>>
>>> So, I am not able to retrieve TcpConnTable using SNMP4J.
>>> Anybody
>>> has any
>>> suggestions? How can I get these variables?
>>>
>>> I have tried to use GetNext and GetBulk methods but the
>>> problem
>>> is the same,
>>> I do not know the exact name of the OID that I want to
>>> retrieve.
>>> I hope I
>>> have expressed correctly the problem and everybody
>>> understand it.
>>>
>>> Thanks in advanced,
>>> Kike
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org <mailto:SNMP4J at agentpp.org>
>>> <mailto:SNMP4J at agentpp.org <mailto:SNMP4J at agentpp.org>>
>>>
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>>
>>>
>>> -- AGENT++
>>> http://www.agentpp.com
>>> http://www.mibexplorer.com
>>> http://www.mibdesigner.com
>>>
>>>
>>>
>>> -- AGENT++
>>> http://www.agentpp.com
>>> http://www.mibexplorer.com
>>> http://www.mibdesigner.com
>>>
>>>
>>>
>>>
>> --
>> AGENT++
>> http://www.agentpp.com
>> http://www.mibexplorer.com
>> http://www.mibdesigner.com
>>
>>
>>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>
>
>
More information about the SNMP4J
mailing list