4

Hi all im looking for a solution to get multiple oids at the same time. for example is it possible to use list of oids in pysnmp get command generator?

from this:

cmdGen = cmdgen.CommandGenerator()

errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
    0, 25,
    '1.3.6.1.2.1.2.2.1.2',
    '1.3.6.1.2.1.2.2.1.3',
)

to something like:

myoid = ['1.3.6.1.2.1.1.1.0', '1.3.6.1.2.1.1.6.0', '1.3.6.1.2.1.1.6.0']

cmdGen = cmdgen.CommandGenerator()

errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
    0, 25,
    myoids,
)

the actual problem is the oids are variables so im looking for a way to change them easily.

user1229351
  • 1,985
  • 4
  • 20
  • 24

1 Answers1

6

Sure, just pass it *myoids (note the asterisk).

AarhusGuy
  • 61
  • 1