Giter VIP home page Giter VIP logo

Comments (3)

sleepinggenius2 avatar sleepinggenius2 commented on May 22, 2024

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.

sleepinggenius2 avatar sleepinggenius2 commented on May 22, 2024

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.

MyaLongmire avatar MyaLongmire commented on May 22, 2024

Thank you for your help. I will implement your suggestion :)

from gosmi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.