Please help me, this code displays a set of values ​​for Different MIBs, although I only need the values ​​of ifIndex

from pysnmp.hlapi import * for(errorIndication, errorStatus, errorIndex, varBinds) in bulkCmd(SnmpEngine(), CommunityData('community'), UdpTransportTarget(('ip', 161)), ContextData(), 0,25, ObjectType(ObjectIdentity('IF-MIB', 'ifNumber').addAsn1MibSource( 'file:///usr/share/snmp/mibs/ietf'))): if errorIndication: print(errorIndication) break elif errorStatus: print('%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) break else: for varBind in varBinds: print(varBind) 

in the terminal snmpbulkwalk -On -v2c -c 'community' 'ip' Ifindex displays only IfIndex information.

    1 answer 1

    Found the answer. It was necessary to add: lookupMib=True, lexicographicMode=False

     for(errorIndication, errorStatus, errorIndex, varBinds) in bulkCmd(SnmpEngine(), CommunityData('zaBbIX-mON'), UdpTransportTarget(('192.168.57.8', 161)), ContextData(), 0,25, ObjectType(ObjectIdentity('IF-MIB', 'ifIndex').addAsn1MibSource( 'file:///usr/share/snmp/mibs/ietf')), lookupMib=True, lexicographicMode=False ): if errorIndication: print(errorIndication) break elif errorStatus: print('%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) break else: for varBind in varBinds: print(varBind)