[SNMP4J] A question about getTable
Frank Fock
fock at agentpp.com
Wed Aug 13 00:06:17 CEST 2008
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>>
>
> 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>
> 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
More information about the SNMP4J
mailing list