Comments (3)
This is the output I get when I run the attached go program with the standard IETF MIBs and the provided Synology MIBs loaded:
$ go run synology.go
.1.3.6.1.4.1.6574.2.1
node: diskTable
get index: [{{ReadOnly ObjectType The index of disk table Column diskIndex 1.3.6.1.4.1.6574.2.1.1.1 11 Current Type[Integer32 Status=Unknown, Format=, Units=]} 0xc001d09b80 Type[Integer32 Status=Unknown, Format=, Units=]}]
index: map[diskIndex:{}]
order: [diskIndex diskID diskModel diskType diskStatus diskTemperature diskRole diskRetry diskBadSector diskIdentifyFail diskRemainLife diskName]
from gosmi.
One potential flaw that I see in the provided code is that you have a qualified name in your lookup, but you are completely ignoring the module, which might be causing an issue. You are also not returning after an errored GetNode
call. I would suggest doing something like this instead:
...
s := strings.Split(oid, "::")
moduleName := s[0]
module, err := gosmi.GetModule(moduleName)
if err != nil {
fmt.Printf("%v", err)
return
}
node := s[1]
out, err := module.GetNode(node)
if err != nil {
fmt.Printf("%v", err)
return
}
...
As you already have the node in out
at this point, I'm not sure why you are then looking it up again by OID with gosmi.GetNodeByOID(types.OidMustFromString(oidNum))
. Also, if you know the module name, then it's unnecessary to load all the files in the paths first.
from gosmi.
Thank you for your help. I will implement your suggestion :)
from gosmi.
Related Issues (20)
- smi.GetParentNode() seems to always return the Node and not the Parent HOT 1
- Parse Module: Unexpected HOT 5
- MIB parser breaks on unexpected whitespace HOT 8
- oid with numbers and letters HOT 2
- smi.GetNode returns Kind: NodeScalar instead of NodeColumn for a table's subtree HOT 2
- Is there a way to load just all available modules in paths? HOT 2
- GetIndex HOT 3
- Unable to parse RFC-1212 mib HOT 18
- resolve OIDs with indexes HOT 3
- How to get a node's OBJECTS? HOT 2
- RenderNumeric() coming back blank HOT 3
- Unable to get OID for some nodes HOT 5
- Can't parse CISCO-STACK-MIB::sysErrDisableTimeoutEnable DEFVAL HOT 4
- OSIX mib only partially loaded HOT 1
- Relaxed mode for parsing invalid MIBs HOT 3
- testing the sample main.go file under cmd/smi example but facing Null oid error HOT 3
- I am getting out of memory while parsing the Mib and the error is as follows,runtime: VirtualAlloc of 173408256 bytes failed with errno=1455
- gosmi Load modules not loading mib files properly and giving oid's as blank HOT 4
- MIB files not getting parsed completely
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gosmi.