Do I need different MIB with those OID?

I got this legacy powershell script that retrieve information via SNMP, I'm trying to port it in Python using snimpy.

$PrintersIP = '', ''
Function Get-SNMPInfo ([String[]]$Printers) {
    Begin {
        $SNMP = New-Object -ComObject olePrn.OleSNMP
    Process {
        Foreach ($IP in $Printers) {
                Name        = $SNMP.Get(".")
                IP          = $IP
                UpTime      = [TimeSpan]::FromSeconds(($SNMP.Get("."))/100)
                Model       = $SNMP.Get(".")
                Description = $SNMP.Get(".")
                #Contact     = $SNMP.Get(".")
                #SN          = $SNMP.Get(".")
                #Location    = $SNMP.Get(".")
                #TonerName   = $SNMP.Get("")
    End {
Get-SNMPInfo $PrintersIP | ft -AutoSize *
Snimpy usage

From the section Usage of the official documentation they use the load method to load MIB a file.

from snimpy.manager import Manager as M
from snimpy.manager import load

m = M("localhost")
Finding OID name

I can't find the OID name for some of the identifiers. For instance:

  • Depending on the OID's name I'm trying to use, do I need to load different MIB file ? (e.g. Printer-MIB, IF-MIB, etc.)
  • Where can I find the missing OID's name


If you use the load() method then scalars and row names from it will be made available as an instance attributes hence you're able to query for 'sysContact' etc, but as the 'sysDescr' and 'sysName' are not part of the IF-MIB you will not be able to get it.

You will need to load in the relevant MIB such as SNMPv2-MIB or attempt to get the value via the OID directly.

UPDATE: I've had a look and snimpy and it loooks like pysnmp is doing the collection, so you could always user that directly. The sample below is collecting a new different SNMP values some by OID and others via the named variable within the MIB (you will need to have the relevant MIB available if you want to get via the name). This sample is pretty much taken from the pySNMP documentation

from pysnmp.entity.rfc3413.oneliner import cmdgen

cmdGen = cmdgen.CommandGenerator()

errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
    cmdgen.UdpTransportTarget(('', 161)),
    '',            # sysDescr
    '',            # sysObjectId
    '',            # upTime
    '',            # Contact
    '',            # sysName
    '',            # Location
    cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),     #. sysDescr
    cmdgen.MibVariable('SNMPv2-MIB', 'sysName', 0)     #. sysName

# Check for errors and print out results
if errorIndication:
    if errorStatus:
        print('%s at %s' % (
            errorIndex and varBinds[int(errorIndex)-1] or '?'
        for name, val in varBinds:
            print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))

Need Your Help

what are the differnt in <req:xxx> and <ns1:xxx> in SOAP request

xml web-services soap soapui

Can anybody explain the difference between &lt;req:xxx&gt; and &lt;ns1:xxx&gt; usage in soap request xml schema .?

Wrap Text not working properly

html css

I have a table structure like below: