cederberg / mibble

Mibble is an open-source SNMP MIB parser library for Java.
https://www.mibble.org/
Other
113 stars 68 forks source link

I am getting parser exception #20

Closed unnivm closed 8 years ago

unnivm commented 8 years ago

I am getting error while parsing one of the 'cisco' mib file. It is giving me 81 errors. Do I need to add any other files where I have copied my mib file?

Thanks

cederberg commented 8 years ago

Please make sure to include the mibble-mibs.jar file in your CLASSPATH. It is added by default if you run the included MibbleBrowser app (and load the MIB from the UI there).

Please attach the MIB file + the first few error messages here if that doesn't help. Marking this issue resolved until I hear back from you.

unnivm commented 8 years ago

I am developing a parser by porting your code directly into my Eclipse IDE. I am not using any jar file.

Also, I have added one of the mib file found in test folder to "d:\mibrepository", a directory created to keep the custom MiB file

The "MiB" file was taken from this link: Cisco MiB file

Please find my code below:

String fname="D:\mibrepository\ACCOUNTING-CONTROL-MIB.my";

Thanks for your response.

Unni M

On Tue, Jul 5, 2016 at 12:42 AM, Per Cederberg notifications@github.com wrote:

Please make sure to include the mibble-mibs.jar file in your CLASSPATH. It is added by default if you run the included MibbleBrowser app (and load the MIB from the UI there).

Please attach the MIB file + the first few error messages here if that doesn't help. Marking this issue resolved until I hear back from you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cederberg/mibble/issues/20#issuecomment-230343473, or mute the thread https://github.com/notifications/unsubscribe/AA7JG8b6RoR8as559EUdSAqkVQ2jWWSkks5qSVsWgaJpZM4JETQZ .


If not played, Free Sudoku Android Game https://play.google.com/store/apps/details?id=com.gamerfan.sudoku

cederberg commented 8 years ago

I see. The issue then is the following:

  1. The IETF and IANA MIBs aren't "built-in" to Mibble, but are actually loaded when used. You'll find them in https://github.com/cederberg/mibble/tree/master/src/mibs or packaged in the mibble-mibs-2.9.3.jar.
  2. You only need the MIB referenced (recursively), so no need to add all of them to your project unless generic MIB parsing is really the goal.
  3. It is vital that *these specific MIBs are used, since a few of them have been error-corrected. See https://github.com/cederberg/mibble/search?q=FIX+path%3A%2Fsrc%2Fmibs&type=Code

So. You can either include the relevant MIBs under their ietf and iana package into your project. Or add the packaged MIB jar-file as a dependency.

unnivm commented 8 years ago

So either I have to take the "mibble" jar file (which I could not in this repository. Please tell me where it is), or have to add the "mibs" to classpath when parsing the "Mib" files.

when I call MibLoader(), it is adding the above directories

addResourceDir("mibs/iana"); addResourceDir("mibs/ietf");

and I have already added these two folder under mibs/iana and mibs/ietf in my project root.

You only need the MIB referenced (recursively), so no need to add all of them to your project unless generic MIB parsing is really the goal.

My goal is to parse a "cisco Mib" file using this frame work. Since I saw this open source I wanted to try it out. Is it possible to to parse the custom Cisco MiB file?

Thanks

cederberg commented 8 years ago

Mibble downloads are here: http://www.mibble.org/download/

unnivm commented 8 years ago

I have the jar files of mibble frame work and added to my build path. Then I ran that piece of code n. But still I got the same error. Then I downloaded ALL of the "Cisco" related "MiB"s and copied to the folder where I kept my previous file. After that, I ran my code again and it was able to load and parse the content. Please find the few contents in that file.

{alAdminAuthClientUnknownType=1.3.6.1.4.1.3076.2.1.2.39.2.1.14, altigaAdminAuthStatsMibConformance=1.3.6.1.4.1.3076.1.1.44.2.1, }

So basically we need to copy ALL the "CISCO" related files in the folder because of references to these files from my CISCO file. I did not understand this point clearly though you had mentioned it earlier.

Thank you for your prompt support.

--Unni