[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mibble-users] snmpwalk and the loading the MIB files
From: |
punit gupta |
Subject: |
Re: [Mibble-users] snmpwalk and the loading the MIB files |
Date: |
Tue, 14 Dec 2004 10:39:57 -0800 (PST) |
Hi,
Thanks so much for your detailed explanation. It works
alright now. Two more questions:
1. If this API is not supported, what is the
alternate way?
2. Where are these tables stored? I suppose they are
outside the MIBs. I might be asking a very simple
question here, but I really a beginner in the area.
Thanks once again,
-Punit.
--- Per Cederberg <address@hidden> wrote:
> Hi Punit,
>
> I see you are using the undocumented internal Mibble
> API
> for SNMP that the Mibble browser is also using. I
> have no
> problem with this, but you should be aware that it
> is
> unsupported and may change without notice in future
> versions.
>
> The problem you are having is that table OID:s are a
> bit
> special in SNMP. In general and as your code
> assumes, the
> MIB file contains all OID:s and they can be
> retrieved
> through the ObjectIdentifierValue class. However,
> when
> tables are being used, the SNMP agent appends the
> table
> row index to the end of the OID.
>
> So in your case enterprises.5596.10.3.4.1.3 is the
> OID for
> the string column (in the table), whereas the
> appended .1
> .2 and .3 represent the values on the different rows
> in a
> the table. That is, the "children" to the display
> string
> OID that you see are in fact not children at all,
> but
> different table rows.
>
> The solution here is to use the OID returned by the
> getNext() operation as input for another getNext()
> call,
> effectively letting the SNMP agent step through the
> MIB
> instead of the ObjectIdentifierValue class (that
> doesn't
> know how many or which rows exist). In the method
> SnmpPanel.Operation.runGetAll() Mibble implements
> this for
> the Mibble browser:
>
> do {
> response = manager.getNext(oid);
> oid = response.getOid(0);
> if
> (oid.startsWith(request.getOid())) {
> ...
> } else {
> ...
> stopped = true;
> }
> } while (!stopped);
>
> Hope this helps!
>
> /Per
>
> On mon, 2004-12-13 at 12:56 -0800, punit gupta
> wrote:
> > Hello Sir,
> >
> > I am building an application to do snmpwalk for a
> > given OID. It works fine except in the case when a
> > particular OID is of type DisplayString. I am not
> able
> > to get the children of the such
> ObjectIdentifierValue
> > objects. For example if I do the snmpwalk using
> the
> > linux's snmpwalk command with
> > "1.3.6.1.4.1.5596.10.3.4.1.3" for a given ID, it
> gives
> > me following output:
> >
> > SNMPv2-SMI::enterprises.5596.10.3.4.1.3.1 =
> STRING:
> > "130.207.179.65"
> > SNMPv2-SMI::enterprises.5596.10.3.4.1.3.2 = ""
> > SNMPv2-SMI::enterprises.5596.10.3.4.1.3.3 = ""
> > SNMPv2-SMI::enterprises.5596.10.3.4.1.3.4 = ""
> >
> > When I try the same functionality with my custom
> built
> > snmpwalk using the mibble api, it only gives me
> the
> > first one correctly. Here is the code:
> >
> > private static void printOid(ObjectIdentifierValue
> > objectidentifiervalue)
> > {
> > if(objectidentifiervalue.getChildCount() == 0)
> > try
> > {
> > SnmpManager snmpmanager =
> SnmpManager.createSNMPv1
> > (host, port, community);
> > String s = objectidentifiervalue.toString();
> >
> > try
> > {
> > SnmpResponse snmpresponse =
> snmpmanager.getNext(s);
> >
> >
> System.out.println(snmpresponse.getOidsAndValues());
> > }
> > catch(SnmpException snmpexception1)
> > {
> > System.out.println("error occured");
> > }
> > }
> > catch(SnmpException snmpexception)
> > {
> > System.out.println("snmpManager can not be
> created
> > :" + snmpexception.getMessage());
> > }
> >
> > for(int i = 0; i <
> > objectidentifiervalue.getChildCount(); i++)
> > {
> > printOid(objectidentifiervalue.getChild(i));
> > }
> > }
> >
> >
> > When I use the getNext method of SNMPManager on a
> OID
> > which is "child" of a OID Of type DisplayString,
> it
> > still gives me the first "child" of the OID
> > (displayString).
> >
> > I think it has something to do with DisplayString.
> > Since the children of DisplayString type OID are
> not
> > listed in the mib (right??), they do not appear in
> the
> > getChildren method also.
> >
> > Any suggestions would be appreciated.
> > Thanks bunch,
> > -Punit.
>
>
>
>
> _______________________________________________
> Mibble-users mailing list
> address@hidden
>
http://lists.nongnu.org/mailman/listinfo/mibble-users
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com