[pysnmp-users] Problem observed in new mib loading
Brought to you by:
elie
From: <riv...@wi...> - 2016-12-15 06:27:19
|
Hi, I am trying to automate VM-MIB by using pysnmp. 1. Generated VM-MIB.py file from VM-MIB.txt by mibdump.py --debug=all --mib-borrower=/usr/share/snmp/mibs/ VM-MIB.txt 2. Tried loadmib and addmibsource modules to load VM-MIB. Its loading the Object from VM-MIB as I am able to see the output but the MIB name is showing as SNMPv2-SMI. Is it the right procedure to do or do we have any other process. #!/usr/bin/python from pysnmp.entity.rfc3413.oneliner import cmdgen cmdGen = cmdgen.CommandGenerator() errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd( cmdgen.CommunityData('public'), cmdgen.UdpTransportTarget(('10.154.19.88', 161)), #cmdgen.MibVariable('VM-MIB', 'vmEntry').loadmibs(), lexicographicMode=True, maxRows=100, ignoreNonIncreasingOid=True ) #print varBindTable # Check for errors and print out results if errorIndication: print(errorIndication) else: if errorStatus: print('%s at %s' % ( errorStatus.prettyPrint(), errorIndex and varBindTable[int(errorIndex)-1] or '?' ) ) else: #for name, val in varBindTable: #print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) #print (varBindTable[0][0].prettyPrint() +' = '+ varBindTable[0][1].prettyPrint()) len_value= len(varBindTable) output = open('template.txt','a') for i in range(0,len_value): output.write(varBindTable[i][0].prettyPrint()) output.write("\n") output.close() Getting this below output. SNMPv2-SMI::mib-2.23456.1.4.1.2.2 = VM6 ----------- it should represent as VM-MIB instead of SNMPV2-SMI SNMPv2-SMI::mib-2.23456.1.4.1.2.3 = VM1 SNMPv2-SMI::mib-2.23456.1.4.1.2.4 = VM2 SNMPv2-SMI::mib-2.23456.1.4.1.2.5 = VM3 SNMPv2-SMI::mib-2.23456.1.4.1.2.6 = VM4 Thanks & Regards, Riva. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com |