I'm having problems with the pysnmp package.
I want to connect to the OLT device from Huawei MA5600. I have his MIBs in text format * .mib the idea is to get the temperature, energy consumption among others
I have the following code
from pysnmp.hlapi import *
from pysmi import debug
#debug.setLogger(debug.Debug('compiler'))
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData('MyCommunity'),
UdpTransportTarget(('192.168.1.2', 161)),
ContextData(),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.6.0')),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')),
ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2.1.10')),
ObjectType(ObjectIdentity('1.3.6.1.4.1.2011.2.6.7.1.1.1.1.11'))\
.addAsn1MibSource('file:///home/devel/mib/',
'file:///home/devel/mib'
'http://mibs.snmplabs.com/asn1/@mib@',
'http://mibs.snmplabs.com/asn1/',
'file:///home/devel/mib/public/',
'file:///home/devel/mib/public')
)
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
In this case I have the following answer:
(sent) C:\DESARROLLOS\system>python v2c-get.py
SNMPv2-MIB::sysLocation.0 = EPL
SNMPv2-MIB::sysDescr.0 = Huawei Integrated Access Software
SNMPv2-SMI::mib-2.2.2.1.10 = No Such Instance currently exists at this OID
SNMPv2-SMI::enterprises.2011.2.6.7.1.1.1.1.11 = No Such Instance currently exists at this OID
I have also tried to use the addMibSource function to add the python mibs, I have the pysnmp_mibs package but it does not work either.
It should be noted that with the command I get the information I request:
snmpwalk -v 2c -c MyCommunity 192.168.1.2 1.3.6.1.4.1.2011.2.6.7.1.1.1.1.1
It should be noted that with the command I get the information I request.
snmpwalk -v 2c -c MyCommunity 192.168.1.2 1.3.6.1.4.1.2011.2.6.7.1.1.1.1.1
I would be grateful if someone happened to something similar and knows what to do. I am using python 3.6, pysmi == 0.3.2, pysnmp == 4.4.6 and pysnmp-mibs == 0.1.6