12-18-2018 11:46 AM
12-18-2018 10:58 PM
12-18-2018 09:34 PM
12-18-2018 03:38 PM
12-18-2018 01:32 PM
from pysnmp.entity.rfc3413.oneliner import cmdgen
cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
cmdgen.CommunityData('private'),
cmdgen.UdpTransportTarget(('192.168.1.66', 161)),
('1.3.6.1.2.1.1.5.0', rfc1902.OctetString('Testing123'))
)
# Check for errors and print out results
if errorIndication:
print(errorIndication)
else:
if errorStatus:
print('%s at %s' % (
errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex)-1] or '?'
)
)
else:
for name, val in varBinds:
print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))
SW02.10 # load sc snmp.py
1.3.6.1.2.1.1.5.0 = Testing123
SW02.11 #