I'm trying to convert my whole library of MIBs in .mib format to be able to use it with pysnmp, I can import custom paths using the snmpwalk/snmpget in bash as you can see:
$snmpwalk -M +/usr/local/share/ifx/mibs -m PowerNet-MIB
But i want to do it in my code in Python for example:
def snmpget(parser, oid,port):
g = getCmd( SnmpEngine(),
CommunityData(parser.community),
UdpTransportTarget((parser.hostname, port)),
ContextData(),
#-->ObjectType( ObjectIdentity(('1.3.6.1.4.1.318.1.1.10.3.13.1.1.1'))))
#-->ObjectType( ObjectIdentity(('PowerNet-MIB::emsProbeStatusProbeIndex').addMibSource( '/usr/local/share/ifx/mibs/'))))
ObjectType(ObjectIdentity(oid).addMibSource( '/usr/local/share/ifx/mibs/')))
error_i,error_s,error_idx,var_binds = next(g)
if error_i:
print(error_i, file=sys.stderr)
sys.exit( RET_CODES["CRITICAL"])
elif error_s:
print('%s at %s' % (error_s.prettyPrint(),error_i and var_binds[int(error_i) - 1][0] or '?'), file=sys.stderr)
sys.exit( RET_CODES["CRITICAL"])
oId, value = var_binds[0]
return str(value)
as you can see the ObjectType(ObjectIdentity()) could be given with its MIB in numbers or with the expression in words, the problem is that the libs included in pysnmp v4.4.12 don't include the translations to the MIBs I need and my files (like PowerNet-MIB.mib) aren't compatible with pysnmp.
I have found the mibdump.py which is suppose to convert my .mibs files to .py files whichs pysnmp read, I'm not sure if I'm using it bad because in any of my attempts they work
Have someone any idea of how I can get my libraries translated or find them already translated?
In additionI have found a Github repositorie where are a lot of mibs files, but even after import them to my default directory for the mibs /usr/lib/python3.6/site-packages/pysnmp/smi/mibs/ifx I'm not be able to make this work