-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Importing custom mibs #67
Comments
You do not need to prepare MIBs anyhow to let pysnmp consuming them. Do you get all the compiled MIBs in ~/.pysnmp/mibs/ ? Do you have MIB compiler piece uncommented? Have you set up MIB search path properly with all the dependent MIBs present there? I'd suggest setting up http://mibs.snmplabs.com/asn1/ as one of your MIB sources to make sure the dependencies would be satisfied. To see what is happenning under the hood I'd enable pysmi debugging and watch its output:
|
Below is the script template I'm working off of.
I'm unable to locate this directory so no.
I didn't initially however I tried logging it and the same result.
Not sure here. Trying to find documentation on this one. I'm just sourcing the directory with all the MIBs and they work fine in a MIB browsing app.
I can see the steps it's taking to do things more clearly. However, it doesn't like the from arg or the import options provided so I copied some from here
|
The exact same code runs for me with the latest pysnmp and its dependencies. I've a couple of MIBs lended in Can you make sure you are running the latest released pysnmp (which should also pull in its dependencies)?
Can you please elaborate on this? What is the exact error message? Is it that MIB compiler (pysmi) is not installed on your system? |
When I tried to check the version / install of pysmi and pysnmp it said the requirements were met. I uninstalled and reinstalled and it works now. Before it was giving an error that it couldn't find debug. I still have the same issue of the Oids not being populated in the output. I'm adding an example MIB I now have files at ~/.pysnmp/mibs/*.py: IANAifType-MIB.py IP-MIB.py pycache
|
Do you have your MIB (
|
I sure didn't. I see what you mean by the MIB order in the loadingModules method. I have it working as expected now. The code for output to the console has a plug for nodeDesc. Are their ways to pull DESCRIPTION or STATUS as well? I've been looking at the docs and can't find much on the mibView.getNodeLocation method.
|
Sure, you should be able to get everything from MIB definitions. These methods are not yet documented -- this is something to be done in the nearest future. Meanwhile, I can refer you to the code. Make sure to pass
|
Hmm I'm not too familiar with Python. JavaScript is my bread and butter. I'm trying to figure out where to invoke the method my guess is mibBuilder.ObjectIdentity.getDescription because ObjectIdentity is exported from mibBuilder.exportSymbols however that doesn't work. Could you provide an example? Also, I'm looking at the mibBuilder methods addMibCompiler and addMibSources is their support for passing a MIB as JSON as opposed to a flat file? |
The MIBs and the objects defined in MIBs are maintained by the
Once you have the MIB object you can get all the information it has:
Additionally, the
Then look up the MIB object:
And inspect it. If you give it a longer OID (most commonly, the tail of the OID would refer to MIB object instance in SNMP terms), then that tail part would be returned as-is. |
I think I understand how the methods interact with each other from your explanation. When I follow the example with using the custom MIB and object name I get errors. When I use the samples in the loop it doesn't provide the correct description. Maybe I'm missing something? Error
Code
Output
|
I checked my .py mibs that are generated and they also don't have the description. I can see STATUS and MAXACCESS are converted in the .py files. So I'm assuming if it was to be processed properly the data would reside there as well? RS-COMMON-MIB.py
RS-COMMON-MIB.mib
|
The texts should be there... Can you remove everything from
Re-run the script and check the MIB files afterwards? That's to make sure those are not stale files generated before you added the |
I ran rm -rf * in the ~/.psnmp/mibs directory and confirmed nothing was there. After I re-ran the scripts the directory had pretty much the same output. Script
RS-COMMON-MIB.py
|
I believe I'm seeing the same behavior as @BusbyActual - deleted ~/.pysnmp folder, called Edit: this appears to work:
|
Hi all, I've been studying these issues, the old discussions on sourceforge, and the faqs (.rsts) for some weeks, but now I ask your help. I believe I am facing same issue here as @BusbyActual and @thom-nic. I have a new custom .MIB which I added in the directory seen by script (very similar to the posted here). And I have:
pysnmp.smi.error.MibNotFoundError: MIB file "1206v0122.py[co]" not found in search path One thing that I dont understand is that I cannot found the ~./pysnmp folder on my machine. Dumb question: Is this folder expected to be created right after I did "pip install pysnmp"? Or should it be created after run the script itself? python: 3.6.9 Many thanks |
I'm trying to import some custom MIB files and I'm not getting the output I'd expect. A large amount of the modules aren't being shown. I'm using your SNMP MIB browser template. I found a stacked overflow article on how the MIB files need to be formatted to pysnmp format first. According to the docs this appears to be automated now so that might not be the issue. I'm just trying to get a browser / parser for the Oids and their names.
The text was updated successfully, but these errors were encountered: