-
Notifications
You must be signed in to change notification settings - Fork 37
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
how to find node with OID? #14
Comments
I'm not currently familiar with the formerly P-Cube, now Cisco MIBs. Let me grab them and try to replicate what you're seeing and I'll let you know what I find. |
Thanks for your quick reply. Right now, I'm testing with a cisco router, and I downloaded all MIB files for that platform, it's already more than 1400 files. If I don't know what kind of traps are enabled on the router, do I have to load all those modules? Kiwi server seems to have compiled their own db which include most vendors. It works with the cisco router, showing the name, description etc., of the trap. Is this something we can do with gosmi? |
With the example OID given (1.3.6.1.4.1.5655.1.3), I was able to load the SNMPv2-SMI, PCUBE-SMI, and PCUBE-PRODUCTS-MIB modules and If you are not sure which traps are enabled, then you would need to load any module with a TRAP-TYPE or NOTIFICATION-TYPE macro along with their dependencies. There is no pre-compiled database, but it should be possible to create one, if you have all the necessary MIBs. |
Thanks, I'll take a look on mib2go. |
I would suggest looking at one of the options provided by the standard library to generate the list of files to load: |
would you please provide an example on how to run mib2go command? |
In its simplest form, something like this: You can run I also wanted to apologize; I was just re-testing and I was not entirely correct before. The dependencies of a module will be loaded as long as they can be found in the list of paths that has been set. |
yes, when I test get node by name, I iterate thru all loaded modules: for _, m := range gosmi.GetLoadedModules() { Get by name error: Could not find node named sce2000 in module so it looks like the dependency modules are loaded. But gosmi.GetNodeByOID() does not require a module to be passed in. It searches from the root node and fails to reach the node I look for. Do you mind post the code you use to get that node from OID? |
my bad, the code is working fine, it's just the way I pass in the oid is wrong. Thanks. |
I have updated the example in cmd/smi to additionally include the option of searching by OID. I ran my test like this: Also, you do not need to manually loop through all the loaded modules. Running |
thanks for all the help. func GetNode(name string, module ...SmiModule) (node SmiNode, err error) { But it's working now. Thanks a lot |
hi,
I'm trying to get a node by its OID.
A mib file is passed in and the module is loaded fine. It returns the json object that contains the loaded module and nodes. It works if I get the node by name (i.e., call GetNode()), but GetNodeByOID() always fails.
For example, with OID 1.3.6.1.4.1.5655.1.3, it failed after traverse to the second number - 3.
How should I use GetNodeByOID() ? Thanks
The text was updated successfully, but these errors were encountered: