You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to convert OID numbers to MIB from snmm trap messages. To do that, i created MibBuilder object, gave directories of MIBs using addMibCompiler() and load MIB modules using loadModules(). But to convert OID numbers to MIB in more detail like to get name of a sensor of a device from snmp trap message, giving directories of MIBs is not enough. I had to give MIB module names one by one in loadModules(). But this is not an effective solution, so is there any other method or way for this?
I put an example from the code below:
`from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher
from pysnmp.carrier.asyncore.dgram import udp
from pyasn1.codec.ber import decoder
from pysnmp.proto import api
from pysnmp.smi import builder, view, compiler, rfc1902
You should be able to call mibBuilder.loadModules(), simply without specific module names. That forces PySNMP to load as many modules as possible from all sources of MIB documents, so can hurt performance if you put too many MIB documents there but do not actually need to load all of them.
Since you define what is "an effective solution" for yourself, now you know what options provided by this library.
Hi,
I try to convert OID numbers to MIB from snmm trap messages. To do that, i created MibBuilder object, gave directories of MIBs using addMibCompiler() and load MIB modules using loadModules(). But to convert OID numbers to MIB in more detail like to get name of a sensor of a device from snmp trap message, giving directories of MIBs is not enough. I had to give MIB module names one by one in loadModules(). But this is not an effective solution, so is there any other method or way for this?
I put an example from the code below:
`from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher
from pysnmp.carrier.asyncore.dgram import udp
from pyasn1.codec.ber import decoder
from pysnmp.proto import api
from pysnmp.smi import builder, view, compiler, rfc1902
mibBuilder = builder.MibBuilder()
compiler.addMibCompiler(mibBuilder, sources=['file:///var/lib/mibs/ietf', 'file:///var/lib/mibs/iana'])
mibViewController = view.MibViewController(mibBuilder)
mibBuilder.loadModules('SNMPv2-SMI', 'SNMPv2-TC', 'SNMPv2-MIB', 'RFC1213-MIB', 'IF-MIB')
.
.
.
varBinds = [rfc1902.ObjectType(rfc1902.ObjectIdentity(x[0]), x[1]).resolveWithMib(mibViewController) for x
in varBinds]
.
.
.
`
The text was updated successfully, but these errors were encountered: