python - How to use JSON in pysnmp -


hi im looking way use json array of oids in pysnmp inout data this:

(     # 1-st target (snmpv1 on ipv4/udp)     ( cmdgen.communitydata('public', mpmodel=0),       cmdgen.udptransporttarget(('demo.snmplabs.com', 161)),       ( cmdgen.mibvariable('snmpv2-mib', 'sysdescr', 0),         cmdgen.mibvariable('snmpv2-mib', 'syslocation', 0) ) ),     # 2-nd target (snmpv2c on ipv4/udp)     ( cmdgen.communitydata('public'),       cmdgen.udptransporttarget(('demo.snmplabs.com', 161)),       ( cmdgen.mibvariable('snmpv2-mib', 'sysdescr', 0),         cmdgen.mibvariable('snmpv2-mib', 'syslocation', 0) ) ),     # 3-nd target (snmpv3 on ipv4/udp)     ( cmdgen.usmuserdata('usr-md5-des', 'authkey1', 'privkey1'),       cmdgen.udptransporttarget(('demo.snmplabs.com', 161)),       ( cmdgen.mibvariable('snmpv2-mib', 'sysdescr', 0),         cmdgen.mibvariable('snmpv2-mib', 'syslocation', 0) ) ),     # 4-th target (sn mpv3 on ipv6/udp)     ( cmdgen.usmuserdata('usr-md5-none', 'authkey1'),       cmdgen.udp6transporttarget(('::1', 161)),       ( cmdgen.mibvariable('snmpv2-mib', 'sysdescr', 0),         cmdgen.mibvariable('snmpv2-mib', 'syslocation', 0) ) ),     # n-th target     # ... ) 

and call this:

for authdata, transporttarget, varnames in targets:     acmdgen.getcmd(         authdata, transporttarget, varnames,         # user-space callback function , context         (cbfun, (authdata, transporttarget)),         lookupnames=true, lookupvalues=true     ) 

it great if provide sample.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -