-
-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading uncompiled MIB files. #229
Comments
Your code seems correct and it works for me. Try adding some
To see the search process:
BTW, if you add this URL to the MIBs repo, all your MIBs would be resolved:
|
I turned on the debugging you suggested and that did let me move forward some. I still gets lots of behavior I just can't figure out. Here's a concise example. How can I load module SNMPv2-CONF, have it work, and just a few lines later have it not be available? I've been trying to make sure that Anyway, it seems my local directory of MIBS did not have SNMPv2-CONF.MIB in it (Oddly Nokia seems to include every other dependency but that one in their zip of MIBS). If I put an uncompiled copy in there I can move ahead but quickly hit more unexplainable output. This particular MIB seems to be the first place I spot problems so I'll include it as an example. #!/usr/bin/env python
from pysmi import debug as pysmi_debug
from pysnmp.smi import builder, view, compiler, rfc1902, error
def main():
pysmi_debug.setLogger(pysmi_debug.Debug('compiler'))
mibBuilder = builder.MibBuilder()
compiler.addMibCompiler(mibBuilder, sources = ['file:///tmp/testing/python-udp/testmibs/', ])
mibBuilder.loadModules('SNMPv2-CONF')
mibViewController = view.MibViewController(mibBuilder)
modName = mibViewController.getFirstModuleName()
while 1:
if modName: print(modName)
try:
modName = mibViewController.getNextModuleName(modName)
except error.SmiError:
break
mibBuilder.loadModules('IANAifType-MIB')
if __name__ == '__main__':
main()
I appreciate that you have an extensive collection of MIBs available but it's important for me to understand how to get local MIBs loaded properly since I expect that I will need versions of MIBs which you don't yet have available. For example, I'm using rev 16.0 of TIMETRA-CHASSIS-MIB since I'm getting some traps which were added in recent firmware versions. |
Do you also have the Generally, to compile a MIB you have to have all the MIBs it imports (and the MIBs they import and so forth). In other words, you have to have all the MIBs in the dependency chain in uncompiled form. |
I did not have that MIB in the local collection. I knew there was a pre-compiled version included in I was also getting stuck on a couple of things which seem to be unique to the vendor MIBs I'm looking at. One, neither Juniper nor Nokia seem to include SNMPv2-CONF in their packages of "all" the MIBs they need so I had to grab that since the precompiled one doesn't help. Second, Nokia is including a version of SNMPv2-SMI which has most of the basic type definitions commented out which lead to head-scratching errors like I am still having some compilation issues but I think those are specific to the vendor MIBs rather than my understanding of how to use the |
Good to know you are progressing! Yeah, MIBs are frequently broken in one way or the other... We had to implement a bunch of exceptions in the SMI grammar in the pysmi library to work around those weird nuisances. |
Just a wish: it would be very helpful if the exception contained the actual error reason, e.g. "Couldn't find dependency WHATEVER-MIB for SOME-MIB" or "Error in SOME-MIB", etc. The currently reported "file not found" is extremely confusing. I'm facing a similar problem now with pysnmp 7.1.8 and this simple program:
I used
I'm currently quite stuck. Any help would be appreciated. Thanks. P.S. Do you know why latest Ubuntu 24.04 LTS still has pysnmp 4.4.12 ? Is there any place where documentation for that extremely outdated version can still be found? I failed to google it. |
Oh, almost as soon as posted the comment, I have found out the reason it was failing. The MIB I was loading was demanding Nonetheless, I was able to find that out only using Clearer error messages could save me a day of debuggng. |
@f1r35pirit this repo is abandoned, #429, so if you wish the error message to be clearer, this isn't the place to report. |
i was facing the similar issue that my private mib is not compile. how do i resolve the issue of "Unsigned32"? |
@kdarjoshi That indicates you are using very wrong versions of PySNMP and PySMI. Please read #429 to learn where to get started. |
I'm stumped on what I would think would be a simple task. The sample script "SNMP MIB browser" gives every indication that
compiler.addMibCompiler(mibBuilder, sources=['/usr/share/snmp/mibs'])
adds a MIB compiler to load uncompiled MIBs and thatmibBuilder.addMibSources(builder.DirMibSource('/opt/pysnmp_mibs'))
is to add a source containing pre-compiled MIBs.The
loadModules()
all work until the one to loadIANAifType-MIB
which is the first one which isn't included in pysnmp itself. At no point does it give any indication that it's looking in the directory I specified. I've tried numerous variations on the theme but cannot find anything which works. Is there a concise code snippet for loading uncompiled MIBs? Thanks in advance.The text was updated successfully, but these errors were encountered: