Giter VIP home page Giter VIP logo

Comments (3)

samibrahiem avatar samibrahiem commented on May 16, 2024

I am facing the same problem, when I try getting Opaque type OID, I only get the tag. The rest of the values (iid,val and type) are set to "None". Is there a way to read these OIDs through EasySNMP?

from easysnmp.

cmpetty avatar cmpetty commented on May 16, 2024

i never found a way through easysnmp to get/set opaques.

i used pysnmp to get them, but then had to covert them .. here's a sample:

from pysnmp.entity.rfc3413.oneliner import cmdgen 

cmdGen = cmdgen.CommandGenerator()
     cmdgen.UdpTransportTarget((crateip, 161)),
                                                                            '1.3.6.1.4.1.19947.1.3.2.1.12', #outputCurrent
                                                                            '1.3.6.1.4.1.19947.1.3.2.1.10', #outputVoltage
                                                                            '1.3.6.1.4.1.19947.1.3.2.1.7', #outputMeasurementCurrent
                                                                            )

        currdata = []
        currtime = time.time()

        for var in varBinds:
            for sv in var:
                oidsplit = sv[0].getOid().prettyPrint().split('.')
                chanidx = oidsplit[-1]
                oid_noidx = '.'.join(oidsplit[:-1])
                name = mibLUT[oid_noidx]

                if re.search('opaque',sv[-1].prettyPrintType(),re.IGNORECASE):
                    outval = struct.unpack('>f',sv[-1].asOctets()[3:])[0]
                else:
                    outval = sv[-1]._value
                currdata.append([currtime, name, outval, chanidx ])

        thisdf = pd.DataFrame(currdata,columns=['measurementTime','measurementType','measurementValue','channel'])

from easysnmp.

samibrahiem avatar samibrahiem commented on May 16, 2024

Thank you for sharing Chris! :)

from easysnmp.

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.